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

Retrieve complete term information when using aggregations #2078

Closed
moraleida opened this issue Feb 11, 2021 · 0 comments · Fixed by #2071
Closed

Retrieve complete term information when using aggregations #2078

moraleida opened this issue Feb 11, 2021 · 0 comments · Fixed by #2071
Assignees
Milestone

Comments

@moraleida
Copy link
Contributor

moraleida commented Feb 11, 2021

Is your enhancement related to a problem? Please describe.

Bucket aggregations in Elasticsearch cannot retrieve more than one field at a time, this is a known limitation. Because of this, when dealing with custom facet selections, usually a developer needs to query the database for extra information about each facet to be able to reconstruct the UI filters. Usually this means either querying for all terms in a given taxonomy (as we do for the Facet Widget) or querying for each term individually.

This requires facets to be processed on the server and involve the WordPress database, adding server load, and ultimately leading to poor load times when dealing with large numbers of aggregations.

Describe the solution you'd like

The ideal scenario for client-side search is that all the elements needed to rebuild the UI be present in the Elasticsearch response. #2071 addresses this by creating a facet field of type keyword in the mapping of term objects attached to post objects. The new field contains a non-analyzed text representation of the term object in JSON form.

The PR also introduces a new filter ep_facet_use_field, with a default value of slug, allowing developers to choose from one of the available fields in any term object: slug (default), term_id, name, parent, term_taxonomy_id, term_order, and the new field introduced: facet.

The new filter gives developers the freedom to retrieve aggregations based on the field that is most convenient to their needs.

@moraleida moraleida added the type:enhancement New feature or request. label Feb 11, 2021
@felipeelia felipeelia added needs discussion enhancement and removed type:enhancement New feature or request. labels Feb 19, 2021
@mckdemps mckdemps modified the milestones: Future Release, 3.6.0 Feb 22, 2021
@mckdemps mckdemps added qa new feature Label for new, potentially bigger features and removed needs discussion new feature Label for new, potentially bigger features labels Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants