Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search: Maintain ordering of Aggregations between code and display in widget #8096

Closed
nickdaugherty opened this issue Nov 2, 2017 · 0 comments
Labels
[Feature] Search For all things related to Search [Type] Bug When a feature is broken and / or not performing as intended

Comments

@nickdaugherty
Copy link
Contributor

nickdaugherty commented Nov 2, 2017

Steps to reproduce the issue

Apply filters (Aggregations) by using the Jetpack_Search::set_filters() function, then run a search and observe the ordering of the filters as displaying in the Widget - they can be out of order.

What I expected

The ordering of the Aggregations as presented in the Widget should match the ordering from the Jetpack_Search::set_filters() call.

What happened instead

Random ordering in Widget.

Fix

This is fixed on dotcom but needs to come over. ES 2.x doesn't seem to return Aggregations in the same order in which they were passed in the query, where Facets used to be returned in the same order.

Just need a few lines of code to recreate the result array, in the right order.

@nickdaugherty nickdaugherty added [Feature] Search For all things related to Search [Type] Bug When a feature is broken and / or not performing as intended labels Nov 2, 2017
nickdaugherty added a commit that referenced this issue Nov 2, 2017
Elasticsearch doesn’t guarantee the order of returned Aggregations will
match the input order, which leads to unexpected behavior when
rendering the Aggregations in the Widget.

Adds code to re-order the Aggregation results to match the ordering as
passed to `Jetpack_Search::set_filters()`.

Fixes #8096
oskosk pushed a commit that referenced this issue Nov 23, 2017
Elasticsearch doesn’t guarantee the order of returned Aggregations will
match the input order, which leads to unexpected behavior when
rendering the Aggregations in the Widget.

Adds code to re-order the Aggregation results to match the ordering as
passed to `Jetpack_Search::set_filters()`.

Fixes #8096
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Search For all things related to Search [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

No branches or pull requests

1 participant