Copied to clipboard

Flag this post as spam?

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


  • Kurniawan Kurniawan 202 posts 225 karma points
    Nov 11, 2010 @ 01:06
    Kurniawan Kurniawan
    0

    Examine Search Incase sensitive

    Hi All,

    I am using Examine Search, however the results match with case sensitive mode.

    For example, your search string = "home" and "Home" has diffrent result

    Is that possible to tell Examine search criteria not to use INCASE sensitive mode ?

    ==== Here is the code ====

    var criteria = ExamineManager.Instance
                        .SearchProviderCollection[UmbracoSearchProvider.NewQuaySearcher]
                        .CreateSearchCriteria(IndexTypes.Content);

                    var filter = criteria
                        .GroupedOr(
                            new string[]
                            {
                                UmbracoSearchField.NodeName,
                                UmbracoSearchField.NavigationLabel,
                                UmbracoSearchField.HeaderText,
                                UmbracoSearchField.SummaryText,
                                UmbracoSearchField.BodyText,
                                UmbracoSearchField.Advertisement,
                                UmbracoSearchField.CompanyName,
                                UmbracoSearchField.Address,
                                UmbracoSearchField.CreditText
                            }
                        , searchTerm)
                        .Not()
                        .Field(UmbracoSearchField.UmbracoNaviHide, "1")                   
                        .Compile();

                    var rawResult = ExamineManager.Instance
                        .SearchProviderCollection[UmbracoSearchProvider.NewQuaySearcher]
                        .Search(criteria)
                        .Distinct()
                        ;

     

    Thanks

  • Kurniawan Kurniawan 202 posts 225 karma points
    Nov 11, 2010 @ 01:39
    Kurniawan Kurniawan
    0

    I found it, I just need to put searhTerm.ToLower(). because examine is put everything into lower case.

    http://www.farmcode.org/?tag=/umbraco+examine+umbraco-examine+.net

     

    But it seems I can't search for contains...

    such as I can search for "about"

    but if I search for "abo" - my about page is not comming up.

    Is that possible to search (not Exact) word ?

    Thanks

     

  • Qube 74 posts 116 karma points
    Nov 11, 2010 @ 02:42
    Qube
    0

    Or, if you're using the latest version of Examine (1.0) you could change your analyzer to one that isn't case sensitive. Just guessing here, but chances are your indexer and searcher in ExamineSettings.config have a line like this:

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

    Which can be changed to:

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

    Rebuild your index, and you should find it's case insensitive without any more effort.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Nov 11, 2010 @ 03:04
    Aaron Powell
    0

    Refer to this article on text casing with Examine: http://farmcode.org/post/2010/08/23/Text-casing-and-Examine.aspx

  • Kurniawan Kurniawan 202 posts 225 karma points
    Nov 11, 2010 @ 04:16
    Kurniawan Kurniawan
    0

    Hi Ben,

    Which one should I change ? Is it the Examine Index provider / the Search provider ?

    Can I use Index Provider = whitespace  and search provider is standard ? Is this will work ?

    In Farmcode blog said that these analyzer is lowercased.

    • StandardAnalyzer
    • StopAnalyzer
    • SimpleAnalyzer

    But you said if i changed it than it will take the lowercase out.

    Thanks

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Nov 11, 2010 @ 04:20
    Aaron Powell
    0

    The majority of the time (ie - unless you really understand what the analyzers are doing and are writing one yourself) you should be using the same analyzer for indexing and searching.

  • Qube 74 posts 116 karma points
    Nov 11, 2010 @ 04:35
    Qube
    0

    "But you said if i changed it than it will take the lowercase out."

    That's not what I said :P

    Anyway, upgrade to the latest Examine (if you haven't already), use the StandardAnalyzer (for both, as slace said), forget about case sensitivity. The only reason you need to worry about what's going in to the index is if you want to output it. Slace' instructions a few posts up will help you with that.

  • Kurniawan Kurniawan 202 posts 225 karma points
    Nov 11, 2010 @ 04:49
    Kurniawan Kurniawan
    0

    Ok,.. Thanks for you help.

    Do you know when this will be reindex ?

    Is it when the application starts / when you start republish the whole site ?

     

    Thanks

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Nov 11, 2010 @ 13:21
    Aaron Powell
    0

    The index is only rebuilt under the following conditions:

    • You have no Index folder at all and a node is published (or saved if you're supporting unpublished)
    • You call the API method to rebuild the index

  • Kurniawan Kurniawan 202 posts 225 karma points
    Nov 12, 2010 @ 00:03
    Kurniawan Kurniawan
    0

    In my case, I have tried to clear that index folder and trigger publish via right click but doens't work.
    I have to save and publish for each page then it will create the index.

    do you know how to call the API to rebuild the index ?

     

    Thanks

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Nov 13, 2010 @ 10:16
    Aaron Powell
    0

    You only have to publish one page for an indexing to run on every page when no index exists. This has to be a save & publish, reloading content will not do it.

Please Sign in or register to post replies

Write your reply to:

Draft