Calling Developers!
We are reenergizing our code contribution process! Learn More

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, in the second challnge of "Content & Search" it seems like the query expander doesn't hav

Options
U01E6Q6AMHC
U01E6Q6AMHC Posts: 48 🧑🏻‍🚀 - Cadet
edited November 2020 in Academy

Hello, in the second challnge of "Content & Search" it seems like the query expander doesn't have any effect anymore. The list of dependencies is a little different like the one in the code and probably that affects my expander is not "ignored". Current list of plugins:

new StoreQueryExpanderPlugin(),
new LocalizedQueryExpanderPlugin(),
new ProductPriceQueryExpanderPlugin(),
new SortedQueryExpanderPlugin(),
new SortedCategoryQueryExpanderPlugin(CategoryFacetConfigTransferBuilderPlugin::PARAMETER_NAME),
new AttributeCartBasedBoostingQueryExpanderPlugin(),
new PaginatedQueryExpanderPlugin(),
new SpellingSuggestionQueryExpanderPlugin(),
new IsActiveQueryExpanderPlugin(),
new IsActiveInDateRangeQueryExpanderPlugin(),
new CustomerCatalogProductListQueryExpanderPlugin(),
new MerchantReferenceQueryExpanderPlugin(),

/**
 * FacetQueryExpanderPlugin needs to be after other query expanders which filters down the results.
 */
new FacetQueryExpanderPlugin(),

I've tried changing the order but didn't help.

Edit: it seems SortedCategoryQueryExpanderPlugin is responsible for that. Commenting that it will solve the issue. But it's probably not the correct approach, right?

Comments

  • @U01AHAH9478 can you have a look here?

  • Ok, I will check after lunch

  • Yes, I can check it, but looks like Eduard find it out what’s the issue

  • well, we should check why commenting the above plugin solves the problem

  • let’s have a look

  • Yeap

  • first guess -> we are setting our sort only as secondary sort, so it looks like it has no effect

  • final check tomorrow, then we’ll correct! thanks for spotting!

  • Unknown
    edited November 2020
    Options

    theory: using setSort() instead of addSort would do the trick, but also disabling all other sorting. did you try yo move the sorting plugin from the task above the sorted category plugin?

  • nope, my theory was wrong. but i could confirm the behaviour, investigating

  • of course it only breaks on category pages, as the plugin name suggests. if you go through the search page it still works as intended

  • ok, solved.addSort() in the Elasticalibrary effectively replaces the sorting. Elasticsearch is actually capable of more 🤷

  • maybe it doesn’t even make sense what i am writing 😄 it’s late

  • yes does not make sense… it is actually much simpler. our function_score scoring is not in effect since we explicitly sort in SortedCategoryQueryExpanderPlugin if we are in a category page.

  • we will add the solution to remove that plugin and why. thanks, @U01E6Q6AMHC! /cc @U01AHAH9478

  • U01E6Q6AMHC
    U01E6Q6AMHC Posts: 48 🧑🏻‍🚀 - Cadet
    edited November 2020
    Options

    Thank you @UJN2JRU4F for this investigation! 🙂