Copied to clipboard

Flag this post as spam?

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


  • Amir Khan 1284 posts 2741 karma points
    Apr 07, 2014 @ 17:53
    Amir Khan
    0

    Fuzzy search

    Hi,

    How would I pass in arguments like "Fuzzy" or "Boost" into this search? It seems like this should work but its throwing a error: query.AppendFormat("-{0}:1 ", model.HideFromSearchField, Fuzzy());


    Any ideas?

    -Amir

  • Amir Khan 1284 posts 2741 karma points
    Apr 25, 2014 @ 16:22
    Amir Khan
    0

    Anyone able to get this working?

  • Dan White 206 posts 510 karma points c-trib
    Jan 17, 2015 @ 00:50
    Dan White
    1

    Amir, as a quick hack (not a proper solution at), in the searchTerms loop, I just replaced the term with one with some fuzziness and then took out the wildcard "*" because they were conflicting. There are ways to have them work together, but I didn't really need it in my case. Anyway, here's what I did.

    foreach (var term in model.SearchTerms)
    {
        string t = string.Format("({0}~0.6)", term.Trim().Replace(" ", "~0.6 "));
    
        var groupedOr = new StringBuilder();
        foreach (var searchField in model.SearchFields)
        {
            groupedOr.AppendFormat("{0}:{1} ", searchField, t);
        }
        query.Append("+(" + groupedOr.ToString() + ") ");
    }

    I modified in both loops where it goes over the search terms. 

    Hope this helps.

Please Sign in or register to post replies

Write your reply to:

Draft