-
Notifications
You must be signed in to change notification settings - Fork 314
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
Add a Comments Indexable #1531
Add a Comments Indexable #1531
Conversation
… feature is activated.
…ry. Format results properly for the front-end.
… the search and parent params.
@brandwaffle @tlovett1 @tott please let me know once this gets through code review and if there are any changes needed from that review... thanks! |
@felipeelia thanks for the review 🙏 (1) I've fixed this issue and added some tests. (2) I've updated to better integrate with Protected Content enabled. However, I noticed that the Comments page does a lot of queries to retrieve the comments. |
@Rahmon assigning back to you to sort the last issue with WC orders and client notes as we've discussed. Thanks! |
Description of the Change
Similar to #1443, a new filter was added to WordPress core and is coming in 5.3 that allows comment queries to be short-circuited with your own results. This provides ElasticPress the ability to take over any queries that utilize
WP_Comment_Query
.This PR adds a new Comments Indexable that will index all comments across a site (regardless of comment type or status) and then takes over
WP_Comment_Query
ifep_integrate
is true or if thesearch
argument is used.Benefits
Comments will now be stored in elasticsearch and can be searched across as needed. Any queries that make use of
WP_Comment_Query
, either directly or indirectly, can gain potential performance benefits by utilizing an elasticsearch query over a traditional database query.Possible Drawbacks
Not all queries will be made faster by this integration, so testing will need to be done to determine if it's worth using elasticsearch for comment queries in all situations.
Verification Process
Tested these changes locally on a multisite install, with 4 sites on the network. Each site had a handful of comments, some of these had replies, others did not.
WP_Comment_Query
, withep_integrate
set to true, runs the query against elasticsearchWP_Comment_Query
supports, to make sure those work when run against elasticsearchNote further testing is recommended here, to further ensure all the various query params work, especially when used in conjunction with each other.
Checklist: