Copied to clipboard

Flag this post as spam?

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


  • Mahgo 32 posts 152 karma points
    Jan 02, 2017 @ 08:15
    Mahgo
    1

    Examine order by string case insensitive?

    Has anyone worked out to OrderBy a string with Examine case insensitively? For example:

    BaseSearchProvider searcher = ExamineManager.Instance.SearchProviderCollection["FooSearcher"];
    ISearchCriteria searchCriteria = searcher.CreateSearchCriteria(IndexTypes.Content);
    IBooleanOperation boolOperation = searchCriteria.NodeTypeAlias("foo");
    boolOperation = boolOperation.And().OrderBy(new SortableField("fooString", SortType.String));
    ISearchResults results = searcher.Search(boolOperation.Compile());
    

    If the "fooString" values in the index are "AAA", "bbb" and "CCC", they would be ordered by the above code as "AAA, "CCC, "bbb", whereas I'd want them to return as "AAA", "bbb", "CCC"

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Jan 03, 2017 @ 17:08
    Damiaan
    1

    Or your indexer needs to index in lowercase, or your analyser needs to be case insensitive.

    There is an old, but very well explained, blogpost by Aaron on how to rule on text casing with examin.

  • David Peck 687 posts 1863 karma points c-trib
    Jan 04, 2017 @ 14:51
    David Peck
    0

    Damiaan is spot on, AFAIK. I'd go with a case-insensitive Analyser (such as the StandardAnalyzer)

  • Mahgo 32 posts 152 karma points
    Jan 05, 2017 @ 12:05
    Mahgo
    0

    One of my indexes is using the StandardAnalyser but still has the issue, which is weird. Also, I forgot to mention I'm using Umbraco 7.5.6

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Jan 05, 2017 @ 15:18
    Damiaan
    0

    The analyser runs when things are indexed. So if you change your analyser, you need to reindex. Have you done this?

  • Mahgo 32 posts 152 karma points
    Jan 06, 2017 @ 11:50
    Mahgo
    0

    Yeah, multiple times.

  • Damiaan 442 posts 1301 karma points MVP 6x c-trib
    Jan 06, 2017 @ 13:54
    Damiaan
    0

    Where have you specified your analyser? Which analyser are you using?

    If you run your query in the umbraco backend (using the developer dashboard/Examine Management/Your Searcher) using the lucene syntax, are the results as selected?

    If that is not working, have you tried LUKE double check your query?

  • Mahgo 32 posts 152 karma points
    Jan 09, 2017 @ 05:36
    Mahgo
    0

    I have specified my analyzer in ExamineSettings, under providers:

     <add name="FoosIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine"
              supportUnpublished="false"
              supportProtected="true"
              analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net"
               />
    

    Yeah I tried searching in the umbraco backend; the results are as expected, but as there is no ordering specified there's no way to test that there.

    Yeah I've been using LUKE a bit. Is it possible to set the ordering when searching though?

Please Sign in or register to post replies

Write your reply to:

Draft