Copied to clipboard

Flag this post as spam?

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


  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jun 19, 2012 @ 20:28
    Bo Damgaard Mortensen
    1

    Examine search for exact sentence and single word

    Hi all,

    I'm trying to get my head around searching with both a whole, matching sentence (from an AutoComplete textfield) and just a single word.

    Right now, my search only works if I enter "about" in the search field and the matching result is "About Us". Now, if I choose "About Us" from the autocomplete dropdown and use that as my searchterm, it returns no results at all.

    I'm aware that it's because I'm using the MultipleCharacterWildcard() method for my search query, but is there a way to make it search both with and without it?

    My query looks like this atm:

    ISearchCriteria criteria = ExamineManager.Instance.SearchProviderCollection["GlobalContentSearcher"].CreateSearchCriteria();
            IBooleanOperation query = criteria.Field("header", searchTerm.MultipleCharacterWildcard()).And().Field("_siteLanguage", language);
            ISearchResults results = ExamineManager.Instance.SearchProviderCollection["GlobalContentSearcher"].Search(query.Compile());

    I've tried with both .Or() and .And(), but without any luck :-/

    Thanks in advance!

    All the best,

    Bo

  • Allan Kirk 36 posts 110 karma points c-trib
    Aug 28, 2013 @ 05:47
    Allan Kirk
    1

    Hi

    Have you looked at this explanation: http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx

    Specifically the section Power Searching with Raw Lucene Queries, which covers searching for whole sentences.

Please Sign in or register to post replies

Write your reply to:

Draft