Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bram Loquet 72 posts 102 karma points
    Apr 21, 2011 @ 09:19
    Bram Loquet
    0

    don't get ExamineSearch to work properly


    I configured Examine Search to search for a specific searchstring in a few fields but it seems like I only get results for searchterms that exists in the nodeName and not for searchterms that exists in one of the UserFields I defined.

    Am I missing something?

    The ExamineIndex I use:

    <IndexSet SetName="WWSIndexSet" IndexPath="~/App_Data/ExamineIndexes/WWS/">
            <IndexAttributeFields>
                <add Name="id" />
                <add Name="nodeName" />
                <add Name="nodeTypeAlias" />
            </IndexAttributeFields>
            <IndexUserFields>
                <add Name="productName_NL"/>
                <add Name="productDescription_NL"/>
                <add Name="productExtraInfo_NL"/>
                <add Name="productSeoKeywords_NL"/>
                <add Name="productSeoDescription_NL"/>
                <add Name="productName_FR"/>
                <add Name="productDescription_FR"/>
                <add Name="productExtraInfo_FR"/>
                <add Name="productSeoKeywords_FR"/>
                <add Name="productSeoDescription_FR"/>
            </IndexUserFields>
            <IncludeNodeTypes>
                <add Name="ProductItemDoctype" />
            </IncludeNodeTypes>
            <ExcludeNodeTypes>
            </ExcludeNodeTypes>
        </IndexSet>

    The ExamineSettings I use:

    <Examine>
      <ExamineIndexProviders>
        <providers>
          <add name="InternalIndexer" type="UmbracoExamine.LuceneExamineIndexer, UmbracoExamine"
               runAsync="true"
               supportUnpublished="true"
               supportProtected="true"
               interval="10"
               analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
      
          <add name="WWSIndexer" type="UmbracoExamine.LuceneExamineIndexer, UmbracoExamine"
               runAsync="true"
               supportUnpublished="false"
               supportProtected="true"
               interval="10"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
               indexSet="WWSIndexSet" />
        </providers>
      </ExamineIndexProviders>
      <ExamineSearchProviders defaultProvider="InternalSearcher">
        <providers>
          <add name="InternalSearcher" type="UmbracoExamine.LuceneExamineSearcher, UmbracoExamine"
               analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
          <add name="WWSSearcher" type="UmbracoExamine.LuceneExamineSearcher, UmbracoExamine"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
               indexSet="WWSIndexSet" />
        </providers>
      </ExamineSearchProviders>
    </Examine>

    and my search:

    ISearchCriteria criteria = ExamineManager.Instance.SearchProviderCollection["WWSSearcher"].CreateSearchCriteria();
    ISearchCriteria filter = criteria
                    .Field("nodeName", SearchTerm.MultipleCharacterWildcard())
                    .Or()
                    .Field("productName_NL", SearchTerm.MultipleCharacterWildcard())
                    .Or()
                    .Field("productName_FR", SearchTerm.MultipleCharacterWildcard())
                    .Or()
                    .Field("productDescription_NL", SearchTerm.MultipleCharacterWildcard())
                    .Or()
                    .Field("productDescription_FR", SearchTerm.MultipleCharacterWildcard())
                    .Or()
                    .Field("productExtraInfo_NL", SearchTerm.MultipleCharacterWildcard())
                    .Or()
                    .Field("productExtraInfo_FR", SearchTerm.MultipleCharacterWildcard())
                    .Or()
                    .Field("productSeoKeywords_NL", SearchTerm.MultipleCharacterWildcard())
                    .Or()
                    .Field("productSeoKeywords_FR", SearchTerm.MultipleCharacterWildcard())
                    .Or()
                    .Field("productSeoDescription_NL", SearchTerm.MultipleCharacterWildcard())
                    .Or()
                    .Field("productSeoDescription_FR", SearchTerm.MultipleCharacterWildcard())
                    .Compile();
    SearchResults = ExamineManager.Instance.SearchProviderCollection["WWSSearcher"].Search(criteria).Distinct();

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Apr 21, 2011 @ 09:42
    Ismail Mayat
    1

    bram,

    if you have not already done so can you download luke for lucene http://www.getopt.org/luke/ then in your search code write out somewhere criteria.ToString() that will give you the query that is being generated by examine. next try and run that query in luke and see what you get, also have a sniff around the index using luke just to see you have data with fields specified.  You either have issue with index or the query being generated is not what you think.

    Regards

    Ismail

  • Bram Loquet 72 posts 102 karma points
    Apr 21, 2011 @ 09:45
    Bram Loquet
    0

    that's the program I was looking for,
    I knew Tim told about a program like that but couldn't remember the name.

    I'll try that first.

    thx

  • Bram Loquet 72 posts 102 karma points
    Apr 21, 2011 @ 10:06
    Bram Loquet
    0

    seems like my config is ok but my query isn't.
    changing my ISeachCriteria to a GroupedOr seems to solve al large part of the problem

                ISearchCriteria filter = criteria.GroupedOr(new[]
                                                                {
                                                                    "nodeName",
                                                                    "productName_NL",
                                                                    "productName_FR",
                                                                    "productDescription_NL",
                                                                    "productDescription_FR",
                                                                    "productSeoKeywords_NL",
                                                                    "productSeoKeywords_FR",
                                                                    "productSeoDescription_NL",
                                                                    "productSeoDescription_FR"
                                                                }, SearchTerm.MultipleCharacterWildcard()).Compile();
Please Sign in or register to post replies

Write your reply to:

Draft