Copied to clipboard

Flag this post as spam?

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


  • Juan David Gutierrez 4 posts 54 karma points
    Aug 01, 2015 @ 03:05
    Juan David Gutierrez
    0

    IQueryable or Expression<Func<T, bool>> with Examine to Linq

    I am using Linq to Examine, and I am trying to do a dynamic query.

    I have the below code

    Expression<Func<MyResultClass, bool>> query = x => true;
    if (searchField.Any())
    {
        query.And(x => x.MyField.ContainsAny(searchField));
    }
    var indexManager = new Index<MyResultClass>(index).Where(query);
    

    But it doesnt work, do you know if Linq To Examine support dynamic querys? Do you know another way to do it? Any issues in my code, Do I coding wrong?

    Thanks

  • Craig Noble 41 posts 584 karma points c-trib
    Aug 05, 2015 @ 18:22
    Craig Noble
    0

    Im sorry for getting back to you late. I will try this out and get back to you. In theory yes it should work. But I will test it out.

    What happens if you initialise it with a query?

  • Juan David Gutierrez 2 posts 71 karma points
    Aug 12, 2015 @ 17:39
    Juan David Gutierrez
    0

    For some reason my account does not work so I create new one.

    I tried to do it with query but I could not, I had a lot of issues. So I am doing raw query directly, without Examine to Linq.

    From Umbraco.Examine.Linq I am using only SearchResultMapper

    Thanks

  • Craig Noble 41 posts 584 karma points c-trib
    Nov 30, 2015 @ 22:29
    Craig Noble
    0

    Hey

    As of 1.1 you can just use multiple where clauses to solve your problem

Please Sign in or register to post replies

Write your reply to:

Draft