Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Aug 02, 2010 @ 06:29
    Tom
    0

    Examine/Lucene turn of case sensitivity

    Hi Guys,

    We're using umbraco examine for searching and want to work out how to turn of case sensitivity for searches IE if we search for "Screwdriver" vs "screwdriver" we get different results. is there something in the search provider config or something we need to turn off?

    Cheers,

    Tom

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Aug 02, 2010 @ 08:29
    Aaron Powell
    1

    It's not possible to turn it off, the only way to do it would be to access the DocumentIndexing event (which only exists on the LuceneExamineIndexer, not the BaseIndexer) and manually put the data into Lucene yourself.

    Further more Lucene's case sensitivity in regards to searching is at an analyzer level, so it's not something would could always control.

    IMO we should change it so that Examine doesn't force case insensitivity, it should come down to the analyzer

  • Tom 713 posts 954 karma points
    Aug 02, 2010 @ 08:32
    Tom
    0

    Yeah it's tricky because we can't get the desired search results because of case sensitivity.. meaning if one user does it one way another other with an upper case then the results really are quite varied...

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Aug 02, 2010 @ 08:33
    Aaron Powell
    1

    Wait, do you mean that you're getting different results or you want to get different results?

  • Tom 713 posts 954 karma points
    Aug 02, 2010 @ 08:36
    Tom
    0

    we're getting different results.. ie search for screwdriver returns 10 results, search for Screwdriver returns 6 results for example..

     

     

    If we tolowerinvariant the query it works for all.. it seems things are getting indexed lowered?

     

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Aug 02, 2010 @ 08:38
    Aaron Powell
    1

    Hmm, I thought it should be case-insensitive, maybe you should do a .ToLower on the search term(s) before adding them to your query.

    Test that with Luke and see how it reacts

  • Tom 713 posts 954 karma points
    Aug 02, 2010 @ 08:40
    Tom
    0

    Thanks slace! how's life at the farm?

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Aug 02, 2010 @ 09:06
    Aaron Powell
    0

    Churning out the Umbraco goodness ;)

    You coming to the meetup?

  • Tom 713 posts 954 karma points
    Aug 02, 2010 @ 09:19
    Tom
    0

    I'll check with the bosses! :) oh and when and where..

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Aug 02, 2010 @ 09:38
  • Mark Mitchell 35 posts 60 karma points
    Jun 11, 2013 @ 07:33
    Mark Mitchell
    0

    I know this ia s pretty old post, but I am having a very similar problem but in my case the .ToLower does not look like it will help.

    I am working on building a search with a raw Lucene query, but the result are definitely being handled as case sensitive for some reason.

    For example: I have a recipe content node that is titled: "Easy Taco Pizza"    When I search pizza I get no results, but if I search Pizza it will return that node.

    Here is the code for building the Lucene query. 

     var searchProvider = ExamineManager.Instance.DefaultSearchProvider.Name;
     var searchCriteria = ExamineManager.Instance.SearchProviderCollection[searchProvider].CreateSearchCriteria(BooleanOperation.Or);
     
     @* Build raw Lucene string for more flexibility *@
     string luceneString = "+nodeTypeAlias:Recipe";
     if (searchString != String.Empty)
     {
      luceneString += " +(";
      luceneString += "nodeName:(+" + searchString.Replace(" ", " +") + ")^5";
      luceneString += " nodeName:" + searchString;
      luceneString += ")";
     }
     
     var query = searchCriteria.RawQuery(luceneString);
     var searchResults = ExamineManager.Instance.SearchProviderCollection[searchProvider].Search(query).OrderByDescending(x => x.Score);

     

    Any ideas what is going wrong?

    Thanks!

     

     

Please Sign in or register to post replies

Write your reply to:

Draft