Copied to clipboard

Flag this post as spam?

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


  • Kenny Burns 173 posts 305 karma points
    Mar 23, 2012 @ 10:46
    Kenny Burns
    0

    Examine Syntax

    Hi Guys,

    I am trying to set up a search for the first time using Examine and so far I have got it working - however I am looking to try and improve it so that it returns things like misspelt words, duplicates and words that contain the search term.

    i.e.

     

    • if someone searches for "dogs" it would return if "dog" was found
    • if someone searches for "recieve" then any searches with "receive" would be found
    I have been doing a bit of reading and seen terms like "fuzzy" and "proximity" being mentioned.
    My filter looks like:
     var filter = criteria
                   .GroupedOr(new string[] { "nodeName", "bodyText", "pageTitle", "pageHeader", "metaTitle", "metaKeywords" }, SearchTerm)
                   .Not()
                   .Field("umbracoNaviHide", "1") // filter out the hidden pages
                   .Compile();
    However i am unsure of how to implement the "fuzzy"?! Can anyone help or point me in the right direction? Are there other methods available? 
    Thanks a lot!

    Kenny

     

  • Kenny Burns 173 posts 305 karma points
    Mar 23, 2012 @ 12:26
    Kenny Burns
    0

    Hi All,

    Got there in much thanks to a couple of posts in the forum and on the Umbraco blog. (in case anyone else is struggling!) :)

    http://our.umbraco.org/forum/developers/api-questions/16709-Umbraco-Examine-and-Wildcardsearching?p=0

    http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx

      var filter = criteria
                   .GroupedOr(new string[] { "nodeName", "bodyText", "pageTitle", "pageHeader", "metaTitle", "metaKeywords" }, SearchTerm.Fuzzy(0.5f))
                   .Not()
                   .Field("umbracoNaviHide", "1") // filter out the hidden pages
                   .Compile();

    Kenny

Please Sign in or register to post replies

Write your reply to:

Draft