Automattic / Automattic/jetpack
Search: show matching meta content in the results/highlighted
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
### Impacted plugin
Jetpack, Search
### What
We match on some meta content, but we don't display/highlight the content in the results.
### How
Original request: https://wordpress.org/support/topic/get-except-in-search-result/ (ACF Flexible Content plugin)
Currently we mark certain meta as "searchable_in_all_content" which means that we will match against the data. (example https://github.com/Automattic/jetpack/blob/trunk/projects/packages/sync/src/modules/class-search.php#L94) In practice this means we put the text into the all_content field that we use for matching. However we do not display highlighting of the content when we match against it because we take the highlights from the separate content/title fields.
We should expand our highlighting so that we can display more of what we are matching against. I'm not sure if it should be in the same content field, or we should have a separate field that we fall back to when there are no matches in the content field. We probably don't want to just blindly apply it to all the meta fields which may mean we need another configuration key to go along with the "searchable_in_all_content" key.
Contributor guide
Research direction
Start with projects/packages/sync/src/modules/class-search.php around the searchable_in_all_content configuration, then trace how all_content matches are turned into highlighted results. The issue leaves the field and configuration design open, so confirm the intended fallback behavior before changing anything. Done means eligible matched meta content is displayed and highlighted without blindly exposing every meta field.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100