alleyinteractive / alleyinteractive/elasticsearch-extensions

Add support for minimum_should_match to aggregations

Open
#51 5 comments 0 reactions 0 assignees View on GitHub
elasticsearch enhancement php
Dominant language
PHP
Stars
5
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### Description

We need a method to be able to include all items in an aggregation, even if no results match those items, as an opt-in feature.

For example, we should have a way of being able to run `elasticsearch_extensions()->get_aggregation_by_query_var( 'taxonomy_custom' )->checkboxes()` and have checkboxes show for all items in the aggregation, even if none of the results match (e.g., show all categories, even if no posts are in a particular category in the results).

### Use Case

A site needs to show an aggregation but listing all the aggregation items available.

### Acceptance Criteria

- Allow an aggregation to be registered with an optional property of the minimum number of items to match in order for the aggregation item to show. This could be set to 0 to show items that don't have any matches (e.g., a category that doesn't have any matches in the results) or a higher number to only show items that have many matches (e.g., 10 to exclude the long tail of matches).

### Comments

This will likely need to be done as a combination of Elasticsearch queries and WordPress database queries, because Elasticsearch won't know about items that are empty (e.g., taxonomy terms that aren't assigned to anything).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.