Automattic / Automattic/jetpack
Filter jetpack_search_should_handle_query does not let any WP_Query query using ES
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
#### tl;dr: with the current code, `jetpack_search_should_handle_query` does not let any WP_Query using ES.
This is the place where [jetpack_search_should_handle_query](https://developer.jetpack.com/hooks/jetpack_search_should_handle_query/) is applied
https://github.com/Automattic/jetpack/blob/bb884c04b32a57e3053f14c56e2f4e0138aef185/modules/search/class.jetpack-search.php#L455-L459
Right after the filter, we call the do_search() method and in the first lines of this method we just allow the main search query to run:
https://github.com/Automattic/jetpack/blob/bb884c04b32a57e3053f14c56e2f4e0138aef185/modules/search/class.jetpack-search.php#L502-L506
### My suggestion:
I think we need to remove the conditional in do_search().
Contributor guide
Research direction
Start in modules/search/class.jetpack-search.php at the linked filter application and the first lines of do_search(). Trace how the filter result reaches do_search(), then verify that non-main WP_Query instances using Elasticsearch are handled as intended; done means the conditional no longer blocks those queries and the relevant search behavior is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100