Copied to clipboard

Flag this post as spam?

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


  • William Djingga 27 posts 53 karma points
    Sep 28, 2011 @ 11:51
    William Djingga
    0

    Searching certain keywords e.g.: 'a' , 'to' , 'and' throws errors on Examine

    Hi All,

    I am using Examine for the search functionality of my current Umbraco project. The implementation is pretty straight-forward (minor modificationn based on the demo code provided from Umbraco Videos).

    I am having issues with searching certain keywords e.g. ; 'a' , 'to' , 'and' , 'with' and pretty much all the words skipped by the analyser.( http://www.aaron-powell.com/lucene-analyzer). The code will fail on the line where ExamineManager.Instance.SearchProviderCollection[ExamineSearcher].Search(filter);
    is executed and returns 'Object reference not set to an instance of an object' error. Searching on other keywords is working fine.

    Has anyone had this issue before? How do you fix this?

    Following are the snippets of the code where I used Examine api to return the search results as well as my examineindex.config and ExamineSetting.config.

    Any helps will be appreciated . Thanks :)

     

       private readonly string ExamineSearcher = "AusSearcher";
      ISearchCriteria criteria = ExamineManager.Instance
                    .SearchProviderCollection[ExamineSearcher]
                    .CreateSearchCriteria(IndexTypes.Content);
       ISearchCriteria filter = criteria
                    .GroupedOr(new[] {"pageTitle"}, searchTerm)
                    .Compile();

       //IT FAILS ON THIS LINE
       ISearchResults searchRes =
                    ExamineManager.Instance.SearchProviderCollection[ExamineSearcher].Search(filter); /

     

     

    <ExamineLuceneIndexSets>
        <!-- The internal index set used by Umbraco back-office - DO NOT REMOVE -->
        <IndexSet SetName="InternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/Internal/">
          <IndexAttributeFields>
            <add Name="id" />
            <add Name="nodeName" />
            <add Name="updateDate" />
            <add Name="writerName" />
            <add Name="path" />
            <add Name="nodeTypeAlias" />
            <add Name="parentID" />
          </IndexAttributeFields>
          <IndexUserFields />
          <IncludeNodeTypes/>
          <ExcludeNodeTypes />
        </IndexSet>
      
        <!-- The internal index set used by Umbraco back-office for indexing members - DO NOT REMOVE -->
        <IndexSet SetName="InternalMemberIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/InternalMember/">
            <IndexAttributeFields>
                <add Name="id" />
                <add Name="nodeName"/>
                <add Name="updateDate" />
                <add Name="writerName" />
                <add Name="loginName" />
                <add Name="email" />
                <add Name="nodeTypeAlias" />
            </IndexAttributeFields>
            <IndexUserFields/>
            <IncludeNodeTypes/>
            <ExcludeNodeTypes />
        </IndexSet>
        <IndexSet SetName="AusIndexSet" IndexPath="~/App_Data/ExamineIndexes/AusIndex/">
            <IndexAttributeFields>
                <add Name="id" />
                <add Name="nodeName"  />
                <add Name="parentID" />
                <add Name="nodeTypeAlias" />
                <add Name="pageTitle" />
                <add Name="content"  />
            </IndexAttributeFields>
            <IndexUserFields>
                <add Name="pageTitle" />
                <add Name="content"  />
            </IndexUserFields>
            <IncludeNodeTypes />
               
            <ExcludeNodeTypes >
                <add Name="HeroBanner"/>
                <add Name="SharedData"/>
            </ExcludeNodeTypes >
                
        </IndexSet>
    </ExamineLuceneIndexSets>

     

     

    <Examine>
      <ExamineIndexProviders>
        <providers>
          <add name="InternalIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
               supportUnpublished="true"
               supportProtected="true"
               interval="10"
               analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
          <add name="InternalMemberIndexer" type="UmbracoExamine.UmbracoMemberIndexer, UmbracoExamine"
               supportUnpublished="true"
               supportProtected="true"
               interval="10"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"/>
            <add name="AusIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
                 runAsync="true"
                 supportUnpublished="false"
                 supportProtected="true"
                 interval="10"
                 analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
                 indexSet="AusIndexSet"/>
        </providers>
      </ExamineIndexProviders>
      <ExamineSearchProviders defaultProvider="InternalSearcher">
        <providers>
          <add name="InternalSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
               analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>
          <add name="InternalMemberSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
               analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcards="true"/>
          <add name="AusSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
      analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcards="true"
               indexSet="AusIndexSet"/>
        </providers>
      </ExamineSearchProviders>
    </Examine>


Please Sign in or register to post replies

Write your reply to:

Draft