Automattic / Automattic/jetpack
Search: allow user to filter post meta into common fields
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
Currently we index common post meta fields into their own fields. This works great for common plugins, but not for completely arbitrary post meta fields. We do have some common post meta fields defined though (e.g. jetpack-search-meta0). I think we could define a filter to remap post meta keys from one name to one of these generic names. Something like:
```
function filter_search_post_meta( $map ) {
return [
'arbitrary-1' => 'jetpack-search-meta0',
'arbitrary-2' => 'jetpack-search-meta2',
];
}
add_filter( 'jetpack_search_post_meta_key', 'filter_search_post_meta' );
```
That map could handle two cases:
- duplicating post meta into new keys as we sync the content
- mapping post meta field names for doing filtering
Needs a bit more thought, and first we need to get the post meta sync code into JP (see https://github.com/Automattic/jetpack/issues/15672).
Contributor guide
Research direction
Review the post meta sync code in Jetpack and the prerequisite work tracked in issue 15672 before deciding how the proposed filter should behave. Compare the two stated cases—duplicating metadata during sync and mapping names for filtering—and define the hook and mapping semantics before implementation; done means the behavior is specified for arbitrary keys and common fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100