Copied to clipboard

Flag this post as spam?

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


  • Sven 34 posts 138 karma points
    May 14, 2020 @ 11:29
    Sven
    0

    Hello,

    I'm trying to create a query that does the following: IF X OR (Y AND Z) with examine. But i can't seem to get the correct result when using the Or() function of umbraco examine.

    My query :

    productSearcher.CreateQuery("content").Field("productCategory" + currentCulture, categoryUdi).Or().GroupedAnd(new[] { "__NodeTypeAlias", "productType" }, new[] { "usedProduct", category.CategoryType.ToString() }).Execute()
    

    Any idea's what i'm doing wrong here ? Thanks !

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    May 14, 2020 @ 11:37
    Ismail Mayat
    0

    sven,

    can you do to string and paste back the generated lucene query?

  • Sven 34 posts 138 karma points
    May 14, 2020 @ 11:47
    Sven
    0

    Hey Ismail,

    Here is the query:

    query = +productCategorynl-be:\"umb document/79a3bdb0444f4593babe1aa9f7f49886\" (+_NodeTypeAlias:usedproduct +productType:heftruck)"

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    May 14, 2020 @ 12:25
    Ismail Mayat
    0

    Sven,

    That query looks correct to me. I would open the index in luke then try and run it. I suspect the problem part is the productCategorynl-be part that udi i am not sure how its stored in index but if you look using luke you may get pointers.

    In fact in luke try the end part of query it should match then try the first part and that may not match.

    Regards

    Ismail

  • Sven 34 posts 138 karma points
    May 14, 2020 @ 12:32
    Sven
    0

    Hey Ismail,

    I'm not sure why it is registering as productCategorynl-be while i set it as "productCategory" + "_nl-be".

  • Ismail Mayat 4511 posts 10090 karma points MVP 2x admin c-trib
    May 14, 2020 @ 12:37
    Ismail Mayat
    0

    The analyser may be stripping the _ although tbh it should only do that on the query part not field name?

Please Sign in or register to post replies

Write your reply to:

Draft