-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New weighting screen with meta support #3068
New weighting screen with meta support #3068
Conversation
This is now in a state where the front end is fully functional (although a confirmation notice on save wouldn't go amiss), so I think it's time to hand it over for the back-end portion to be implemented. There are a number of things that need to be done on the back end. The main thing is to respect the new At the current time any fields added to the weighting configuration will remain even if manual management of metadata is switched back off. This has the advantage of keeping any weighting changes the user made even if they temporarily disable manual metadata management, but could cause issues if weighting is applied for fields that are no longer indexed, or if unexpected fields are searchable. The two possible solutions for this are:
In either case, handling the SKU and Variation SKU fields (and potentially fields added by users or their theme/plugins) could be achieved by cross referencing the weighting configuration with So I believe the remaining work required, most of it back end, is:
Additionally it may be worth adding information to the response when saving the weighting configuration to indicate whether a reindex is required so that the front end can offer to sync. |
@felipeelia Following our discussion today I have now:
With those changes in place, all that is required on the back-end now is changes to indexing so that:
With the sanitising in place no changes to weighting should be required. |
@JakePT I've pushed some commits addressing the backend part that was needed. I've also made some changes that I'd like you to review:
Things that need to be done:
Are numbers 1 and 2 things you think you could help with? Thanks! |
Description of the Change
This PR implements a new
@wordpress/element
-based weighting dashboard with support for making meta fields searchable.Originally based on #2588 but with significant rewrites that were required to work with real data and adapt to changes decided on in subsequent UX discussions.
This PR changes the way meta is indexed by ElasticPress. Currently, by default, ElasticPress only indexes:
_
)ep_prepare_meta_allowed_protected_keys
filter.With this change applied:
ep_prepare_meta_allowed_protected_keys
. This includes keys added by the WooCommerce feature, to ensure that the integration works properly. No other keys will be indexed by deafult, public or private.ep_weighting_fields_for_post_type
filter, as per this blog post, are supported by the new screen. The new default Metadata section uses the keyep_metadata
to avoid conflicts with custom groups, such as the one added in that post's example.ep_meta_mode
filter. When'auto'
is returned by the filter ElasticPress will again index all public meta keys, but users will not be able to manually add keys using the weighting dashboard. When ElasticPress is network activated, this will continue to be the default behaviour.This has the potential to be a breaking change, which is why it was moved to 5.0. Issues could arise if a site is using queries that are integrated with ElasticPress that assume all public meta keys will be indexed. To resolve this issue the user can add the required keys using the new functionality of the weighting screen, or they could restore the previous behaviour using the
ep_meta_mode
filter.Closes #1690
How to test the Change
WIP
Changelog Entry
Added - New weighting dashboard with support for making meta fields searchable.
Credits
Props @JakePT, @mehidi258
Checklist: