Repository navigation
feat(api): add query-wide post-type facets - #4
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7735f3c408
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| $facets = ! empty( $options['include_facets'] ) | ||
| ? $this->facets( $resolver, $collection, $options, $post_types ) |
There was a problem hiding this comment.
Normalize post types before building facets
When a caller uses the comma-separated post_types form already accepted by SearchQueryResolver::sanitizePostTypes(), enabling include_facets passes that string directly to facets(), whose $post_types parameter requires an array, causing a TypeError instead of returning results. The same raw pass-through lets invalid array entries be queried as any and reported under the invalid type; normalize the value once before both the main query and facet construction.
Useful? React with 👍 / 👎.
| { | ||
| "name": "cc-divi5-search-results", | ||
| "version": "0.2.0", | ||
| "version": "0.2.1", |
There was a problem hiding this comment.
Update the npm lockfile with the version bump
This changes the package version to 0.2.1 while package-lock.json still records 0.2.0 both at its root and in packages[""]. That leaves the committed manifest and lock metadata inconsistent and violates the lockfile synchronization contract documented in README.md:271; regenerate and commit the lockfile with the bump.
Useful? React with 👍 / 👎.
0.2.1
Adds opt-in query-wide facet counts to the public SearchEngine API.
Contract
SearchEngine::resolve()accepts:[ 'include_facets' => true, ]and
SearchResultSetnow exposes:Each
SearchFacetcontains:Facet counts reuse the same isolated resolver contract as the main result query and never mutate the global
$wp_query.The extra facet queries are opt-in, so existing consumers keep the 0.2.0 query cost unless they request facets.
Bump: 0.2.1.