Copied to clipboard

Flag this post as spam?

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


  • Anthony Candaele 1197 posts 2049 karma points
    May 22, 2012 @ 14:49
    Anthony Candaele
    0

    how to enable case-insensitive search

    Hi,

    I implemented search with Examine for Umbraco on my website. My configuration looks like this:

    ExamineIndex.config:

     

    <!-- The index set for searching the cepec website -->

        <IndexSet SetName="CepecIndexSet" IndexPath="~/App_Data/ExamineIndexes/Cepec/">

            <IndexAttributeFields>

                <add Name="id" />

                <add Name="nodeName" />

                <add Name="updateDate" />

                <add Name="writerName" />

                <add Name="path" />

                <add Name="nodeTypeAlias" />

            </IndexAttributeFields>

            <IndexUserFields>

                <add Name="bodyText" />

                <add Name="pageDescription" />

                <add Name="publicationTitle" />

                <add Name="publicationAuthors" />

                <add Name="publicationAbstract" />

            </IndexUserFields>

            <IncludeNodeTypes/>

            <ExcludeNodeTypes />

        </IndexSet>

     

    ExamineSettings.config:

    //IndexProvider

    <add name="CepecIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"

                  supportUnpublished="true"

                  supportProtected="true"

                  interval="10"

                  analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"/>

     

    //SearchProvider

    <add name="CepecSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"

                     analyzer="Lucene.Net.Analysis.WhitespaceAnalyzer, Lucene.Net"

                     indexSet="CepecIndexSet"/>

     

    The search works, but it is not case-insensitive.

    On this blogpost by Aaron Powell on case-insensitive search with Examine, I read that I should use the StandardAnalyzer instead of the WhitespaceAnalyser. I tried to replace the WhiteSpaceAnalyzer with the StandardAnalyzer, but then my search page throws a null reference exception on this line:

    var searcher = ExamineManager.Instance.SearchProviderCollection["CepecSearcher"];

    How can I implement case-insensitive search with Examine for Umbraco?

    Thanks a lot for your help,

    Anthony

  • Anthony Candaele 1197 posts 2049 karma points
    May 22, 2012 @ 15:09
    Anthony Candaele
    0

    I find the issue, it was a syntax case, instead of using 

    <add name="CepecSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"

                     analyzer="Lucene.Net.Analysis.StandardAnalyzer, Lucene.Net"

                     indexSet="CepecIndexSet"/>

     

    I should have used:

     

    <add name="CepecSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"

                     analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"

                     indexSet="CepecIndexSet"/>

     

    My case-insensitive search is working now!

     

    Anthony

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies