Copied to clipboard

Flag this post as spam?

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


  • David Armitage 505 posts 2073 karma points
    Aug 16, 2017 @ 05:23
    David Armitage
    0

    Umbraco Examine Lucene Search Multiple Children / Keys

    Hi Guys,

    I am no expert on Examine searching and having a little trouble with the following search.

    public static ISearchCriteria Search(ISearchCriteria criteria, JobSearch search)
    {
        criteria.NodeTypeAlias("job");
        criteria.GroupedOr(new[] { "industries" }, "umb://document/a33327abbd544abfb1a7444e9d59310a").Or();
        return criteria;
    }
    

    Basically what I am trying to do is....

    1. A job has multiple industries

    2. I can see that if a job has multiple industries the field value within the examine data looks like this umb://document/e2f9c57f8f4c4804adb4bbd23eb6ed6f,umb://document/a33327abbd544abfb1a7444e9d59310a

    3. The above query returns jobs which have only one industry and fails to return jobs with multiple industries regardless to if they have one matching the search.

    4. Basically its searching the industries value for an exact match but I need this to be searching if the industries value contains my search value.

    Can anyone point me in the right direction how I should be searching fields based on a contains.

    Kind Regards

    David

  • David Armitage 505 posts 2073 karma points
    Aug 16, 2017 @ 06:07
    David Armitage
    100

    Hi,

    So I think I have found the answer. I still need to run through so testing but it looks like this does the trick.

    criteria.GroupedOr(new[] { "industries" }, "e2f9c57f8f4c4804adb4bbd23eb6ed6f".Fuzzy()).Or();
    

    I had to add an extra using statement to release some extra extension methods I didn't know about.

    using Examine.LuceneEngine.SearchCriteria;
    

    Hope this helps someone having the same problems.

    Kind Regards

    David

Please Sign in or register to post replies

Write your reply to:

Draft