Copied to clipboard

Flag this post as spam?

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


  • Peter van den Dungen 66 posts 365 karma points
    May 24, 2022 @ 16:31
    Peter van den Dungen
    0

    Examine query question

    We are facing an issue on a new Vendr shop.

    The products can contain one or more categories

    1. Towels
    2. Bathrobes
    3. Towels-sale
    4. etc etc

    We use the GetProducts method in the ProductSurfaceController in order to get the (paged) products.

                if (categories.Any())
                {
                    query = query.And().GroupedOr(new string[] { "categoryAliases" }, categories);
                }
    

    The products are shown on the category page, the only thing is, the products in the 'towels-sale' category are also visible on the 'towels' category.

    How does that work in the Examine query?

  • Matt Brailsford 4125 posts 22224 karma points MVP 9x c-trib
    May 25, 2022 @ 07:36
    Matt Brailsford
    100

    Hi Peter,

    I think by default queries are wildcard queries and so it will match any category where the word appears, what you want though is an exact match query.

    I think ultimately you need to wrap the category in quote marks "term" to force it to be an exact match. This SO post might help https://stackoverflow.com/questions/39641983/search-by-exact-words-in-a-phrase-using-umbraco-examine

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies