Enterprise Search: Prevent site's index version leaking into cross-site ES queries - #6973
rebeccahum wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #6973 +/- ##
=============================================
+ Coverage 35.62% 35.66% +0.03%
- Complexity 5210 5214 +4
=============================================
Files 300 300
Lines 21370 21375 +5
=============================================
+ Hits 7614 7624 +10
+ Misses 13756 13751 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes a multisite bug in VIP Enterprise Search where ep_index_name could resolve the index version using the calling site’s options instead of the target site’s options during cross-site queries.
Changes:
- Switch blog context inside
Search::filter__ep_index_name()when resolving version data for a different target blog. - Update/extend PHPUnit coverage to validate cross-site index version resolution behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
search/includes/classes/class-search.php |
Switches blog context when building versioned index names for cross-site queries. |
tests/search/includes/classes/test-class-search.php |
Updates existing data provider expectations and adds a multisite test covering the cross-site version-resolution regression. |
|
Is there a way to do this without switch_to_blog? probably no bueno for very large sites. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
|
I'm not sure how to retrieve the blog context better w/o |
|
@rebeccahum how about |
|
@rinatkhaziev We can't do |
|
This pull request has been marked stale because it has been open for 60 days with no activity. If there is no activity within 7 days, it will be closed. This is an automation to keep pull requests manageable and actionable and is not a comment on the quality of this pull request nor on the work done so far. Closed PRs are still valuable to the project and their branches are preserved. |



Description
This pull request addresses a bug in multisite environments where the search index name version could be incorrectly resolved from the calling site's context rather than the target site. The update ensures that cross-site queries use the correct version data for each site, and adds a test to verify this behavior.
Changelog Description
Fixed
Pre-review checklist
Please make sure the items below have been covered before requesting a review:
Pre-deploy checklist
Steps to Test