feat(site-search): add semantic handling for search queries#2
Merged
Conversation
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
There was a problem hiding this comment.
Pull request overview
Adds an off-by-default “native” site search surface that intercepts eligible front-end ?s= main queries and replaces WordPress keyword search with semantic ranking from wpvdb-search, configurable via a new Settings page.
Changes:
- Introduces a Settings page (enable toggle, mode, pool size, fallback, post types, cache clear) and cache versioning for invalidation.
- Adds a native search surface that flags eligible main queries and short-circuits them via
posts_pre_query, using a transient-cached ranked pool plus per-request readability filtering. - Adds unit tests for settings normalization and native search behavior; updates README and translation catalogs.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| wpvdb-smart-search.php | Loads new Settings and native search surface; initializes them on plugins_loaded. |
| includes/class-settings.php | New admin settings page + sanitization + cache version bumping/clear action. |
| includes/surfaces/class-native-search.php | New native search interception + caching + pagination + visibility filtering logic. |
| tests/bootstrap.php | Extends the test WP stubs to support options/transients/search behavior used by the new code. |
| tests/Unit/SettingsTest.php | Covers settings defaults and sanitization behavior. |
| tests/Unit/NativeSearchTest.php | Covers native search eligibility, caching, pagination, and fallback behavior. |
| README.md | Documents the optional native site search surface. |
| languages/wpvdb-smart-search.pot | Adds new translatable strings and references. |
| languages/wpvdb-smart-search-es_ES.po | Updates Spanish catalog for new strings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Codex <noreply@openai.com>
Co-Authored-By: Codex <codex@openai.com>
Co-Authored-By: Codex <codex@openai.com>
Co-Authored-By: Codex <codex@openai.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an off by default site search surface that can handle eligible WordPress
?s=queries with semantic ranking fromwpvdb-search.Depends on Automattic/wpvdb-search#3.
posts_pre_query.perm => readableon each request before hydration.fields, REST, feeds, previews, WPML, and Polylang in v1.Manual test plan
wpvdb,wpvdb-search, and the dependency PR active on a site with indexed posts./?s=search from the theme search form./smart-search/page.pre_get_postssnippet to setpost_statustoany, then confirm posts the current visitor cannot read are filtered out before display and before the result count is calculated.fields => ids, a taxonomy query, or a date query. Confirm the plugin bypasses semantic handling and lets WordPress search run normally.