Copied to clipboard

Flag this post as spam?

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


  • Jacob Distel 8 posts 28 karma points
    Jan 05, 2012 @ 23:40
    Jacob Distel
    0

    Examine standard analyzer only finds lowercase

    Hello,

    We're having issues with case sensitivity in Examine. Every forum says to use the standard analyzer and rebuild the index, but that is not working. After doing so, our search only finds matching lowercase phrases.

    Here is some of our code. Any suggestions?

    <add name="MRCIndexer"

                type="UmbracoExamine.LuceneExamineIndexer, UmbracoExamine"

                dataService="UmbracoExamine.DataServices.UmbracoDataService, UmbracoExamine"

                runAsync="true"

                supportUnpublished="false"

                supportProtected="false"

                indexSet="MRCIndexSet"

                interval="10"

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

     

    <add name="MySearcher" type="UmbracoExamine.LuceneExamineSearcher, UmbracoExamine"

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

                indexSet="MyIndexSet"/>

     

    <IndexSet SetName="MRCIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/MRCIndex" IndexParentId="1204">

        <IndexAttributeFields>

          <add Name="id" />

          <add Name="nodeName" />

          <add Name="owner" EnableSorting="true" />

          <add Name="writerName" />

          <add Name="path" />

          <add Name="nodeTypeAlias" />

          <add Name="parentID" />

        </IndexAttributeFields>

        <IndexUserFields>

          <add Name="titleMRC" />

          <add Name="summary" />

          <add Name="keywordsMRC" />

          <add Name="content" />

          <add Name="resourceContact" />

          <add Name="testimonialName" />

          <add Name="testimonialBusiness" />

          <add Name="type" />

          <add Name="service" />

          <add Name="industry" />

          <add Name="location" />

          <add Name="owner" EnableSorting="true" />

        </IndexUserFields>

        <IncludeNodeTypes>

          <add Name="Resource Folder" />

          <add Name="Resource" />

        </IncludeNodeTypes>

        <ExcludeNodeTypes />

      </IndexSet>

     

    var criteria = ExamineManager.Instance.SearchProviderCollection["MRCSearcher"].CreateSearchCriteria();

                Examine.SearchCriteria.IBooleanOperation filter = null;

     

                //Check to see what values have been searched for based on the query string and build the filter for search.

                filter = criteria.NodeTypeAlias("resource");

     

                if (Request.QueryString["key"] != null)

                {

                    string[] SearchTermSplit = Split(Request.QueryString["key"], "+", "\"", true);

     

                    int i = 0;

                    for (i = 0; i < SearchTermSplit.Length; i++)

                    {

                        filter = filter.And().GroupedOr(new string[] { "titleMRC", "summary", "keywordsMRC", "content", "resourceContact", "testimonialName", "testimonialBusiness"}, SearchTermSplit[i]);

                    }

                }

     

     

  • Owen 123 posts 246 karma points
    Jan 06, 2012 @ 08:01
    Owen
    0

    I think you should use same analyzer for Index and search: StandardAnalyzer.

Please Sign in or register to post replies

Write your reply to:

Draft