What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

hello together, how can i modify CatalogSearchQuery to prevent finding certain product_abstract ids

UPX0N1DT2
UPX0N1DT2 Posts: 18 🧑🏻‍🚀 - Cadet

hello together,
how can i modify CatalogSearchQuery to prevent finding certain product_abstract ids, is there a method like '$query->setBlacklist()'

Comments

  • Alberto Reyer
    Alberto Reyer Posts: 690 🪐 - Explorer

    There is no such method.
    But why do you push blacklisted products to the search? If the product should not be shown in the search it shouldn't be pushed as it could have influence of the ranking.

    you could filter this on Yves/Glue side, but this would have the side effect that a search page of 10 results could show only 9, because one is blacklisted. So either fetch more than shown if you would like to implement that in Yves/Glue, and take care of the offset or just don't push the blacklisted products into the search.
    If you want to filter it out during search time (I assume elastic search is used) have a look onto https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html with the must_not operator.

  • UPX0N1DT2
    UPX0N1DT2 Posts: 18 🧑🏻‍🚀 - Cadet
    edited October 2020

    thanks, we have attributes on product_concretes in several variants, and the abstracts should only shown if all facets filter exact matches, currently showed if one of the filters match. i build a subsearchrequest and get now the abstract ids that not matches, i will try must_not operator

  • Alberto Reyer
    Alberto Reyer Posts: 690 🪐 - Explorer

    I suggest dumping/debugging the search query that is send to elasticsearch.
    If I remember correctly inside the bool query there is a "should" operator (OR), this needs to be changed to "must" (AND).

    Sorry we don't use elasticsearch in our project, so I can't test it at the moment.