Open WPprodigy opened 3 years ago
Unless there's a way to treat the parent terms separately in the index so that they are only involved if specifically requested for the query (this way we don't need to re-index if a change is made)?
That said, WP doesn't really have any query params I can find that are meant to "include parents"? There is include_children
, which is handled pre-ES in es-wp-query
here: https://github.com/alleyinteractive/es-wp-query/blob/47a40ab7d6e2860ca47b50532cc9f735d3c5c43b/class-es-wp-tax-query.php#L269-L282
If the terms could be "stored separately" and then only invoked when maybe a new include_parents
query arg is passed, that could be cool. If not possible though to "store separately", this should definitely be opt-in and disabled by default.
https://github.com/Automattic/ElasticPress/blob/develop/includes/classes/Indexable/Post/Post.php#L519-L526
This feels like behavior that should be opt-in rather than opt-out. It changes functionality of queries rather significantly, as before offloading to ES you would only be receiving posts actually attached to a term. But with this enabled - you can get a much more wide range of posts with no way to filter it down since all terms are treated the same in the index.