Automattic / Automattic/jetpack
Feature Request: Search with pre-selected filters
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
### Impacted plugin
Search
### What
We wish to use search a field that will dynamically have a filter pre-selected when used, for example, from an archive page of a taxonomy that is used for filtering in Jetpack Search.
### How
Not sure if I’m able to explain this clearly enough but imagine: a visitor lands on a category archive page and then decides to do a search from the (sidebar or header) search field on that page. It would be great if that search would be done with that specific category automatically selected in the Jetpack Search popup filter.
What we’re currently doing is providing custom buttons that open the Jetpack Search popup. For example a button “Search in Photography” with a link like `?s=&category=photography`. Clicking such a button will successfully open the Jetpack Search popup with the Photography category pre-selected. The user can then start entering search terms and all results will be in the desired category.
It works but… it would be even better if the user could start with entering a search term (in the sidebar or header) without first having to open the pre-filtered search via our custom button.
Thanks for considering or sharing how this could be achieved in a better way that we’re currently doing 🙂
Contributor guide
Research direction
Start with the Search plugin's search field and Jetpack Search popup behavior on a category archive, then trace how the existing `?s=&category=photography` link pre-selects a filter. Determine how a search initiated from the sidebar or header could retain the archive's taxonomy context, and verify that the popup opens with the category selected before search results are shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, php, react
- Domain
- frontend, search, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100