Copied to clipboard

Flag this post as spam?

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


  • Connie DeCinko 931 posts 1160 karma points
    Jul 07, 2016 @ 15:56
    Connie DeCinko
    0

    Unexpected results when adding Fuzzy to Examine search

    We're using Examine to index/search a database of members. I'm trying to rework the code as we are not getting the results to appear as we expect. Basically, we want to search a phrase of firstname lastname. If there is an exact match to a field in the search collection, show it. Otherwise or in addition, show me any similar results.

    I was searching each field separately but it wasn't working as expected. Changed to a GroupOr ...

    .GroupedOr(nameSearchFields, SearchName)
    

    And I get one matching record, ok. I then add Fuzzy ...

    .GroupedOr(nameSearchFields, SearchName.Fuzzy(0.5f));
    

    Trying various values from 0.1 to 0.9. I get lots of results, but NONE of them match my search phrase!

    Ok, so I try this ...

    .GroupedOr(nameSearchFields, SearchName)
    .Or()
    .GroupedOr(nameSearchFields, SearchName.Fuzzy(0.5f));
    

    And I get no results!

    Pulling my hair out, read everything I can find, tried all the examples and forum posts, yet nothing is working.

    Help!

  • Connie DeCinko 931 posts 1160 karma points
    Jul 07, 2016 @ 17:09
    Connie DeCinko
    0

    The more I test, the more frustrated I get. It appears that the second GroupOr never gets hit.

    .GroupedOr(nameSearchFields, SearchName)
    .Or()
    .GroupedOr(nameSearchFields, SearchName.Fuzzy(0.1f));
    

    I should have thousands of results, instead I get zero as only the first GroupOr is being used.

  • Connie DeCinko 931 posts 1160 karma points
    Jul 07, 2016 @ 23:26
    Connie DeCinko
    0

    Here is what I currently have. I can get an exact match result from the first part. No matter what I try, the fuzzy search does not work. Searching for "jon smith" gives me "Jon Smith" but the fuzzy should also return "John Smith" and it does not.

    IBooleanOperation filter = null;
    
    filter = criteria
        .GroupedOr(nameSearchFields, SearchName);
    
    foreach (var t in SearchName.Split(' '))
    {
        filter = filter
            .Or()
            .GroupedOr(nameSearchFields, t.Fuzzy(0.4f));
    }
    
    SearchResults = ExamineManager.Instance.SearchProviderCollection["MemberFinderSearcher"].Search(filter.Compile());
    
Please Sign in or register to post replies

Write your reply to:

Draft