feat(#6645): use AND semantics for docs site multi-word search - #6799
Conversation
Site previewPreview: https://dd3ff2d6-site.fullsend-ai.workers.dev Commit: |
|
🤖 Finished Review · ✅ Success · Started 2:13 PM UTC · Completed 2:27 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $3.72 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Risk Assessment: moderate (2/5) DetailsScore unchanged from prior assessment at 2 (moderate). Tier 1 signals are identical: 4 files, 274 lines, medium blast radius, 0.25 test ratio, bot author. Tier 2 shows mild multi-author contention on doc-site.md (4 authors in 90d) and moderate co-commit coupling, but no regression history or revert signals. Tier 3 confirms tight alignment with issue #6645. Composite (T1=1.5, T2=2.0, T3=1.33 weighted 1.62) rounds to 2. Previous runRisk Assessment: moderate (2/5) DetailsScore increased from 1 to 2 vs prior assessment due to medium blast radius, moderate test-file ratio (0.25), and multi-author contention on doc-site.md (5 distinct authors in 90d). The PR remains well-scoped and aligned with issue #6645, but the composite math (T1=1.5, T2=2.5, T3=1.33 → 1.77 rounds to 2) places it at moderate rather than low. Previous run (2)Risk Assessment: low (1/5) DetailsSmall, well-scoped docs-site search enhancement by a known bot author with good test coverage, stable file history, and full alignment with issue #6645 acceptance criteria. All tier signals remain consistent with prior assessment. Previous run (3)Risk Assessment: low (1/5) DetailsSmall, well-scoped docs-site search enhancement by a known bot author with good test coverage, stable file history, and full alignment with issue #6645's acceptance criteria. Tier 1 signals slightly elevated (4 files, 271 lines, medium blast radius) but offset by zero protected paths, zero security-sensitive files, no dependency changes, and strong Tier 2/3 signals. Composite rounds to 1, consistent with prior assessment. Previous run (4)Risk Assessment: low (1/5) DetailsSmall, well-scoped docs-site search enhancement by a known bot author with good test coverage, stable file history, and full alignment with issue #6645's acceptance criteria. Re-review: all Tier 1 signals unchanged from prior assessment; score remains 1. Previous run (5)Risk Assessment: low (1/5) DetailsSmall, well-scoped docs-site search enhancement by a known bot author with good test coverage, stable file history, and full alignment with a recent issue's acceptance criteria. |
ReviewFindingsLow
Previous runReviewFindingsLow
Next steps:
Previous run (2)ReviewFindingsLow
Next steps:
Previous run (3)ReviewFindingsLow
Previous run (4)Looks good to me Previous run (5)ReviewFindingsLow
Next steps:
|
|
🤖 Finished Fix · ✅ Success · Started 2:29 PM UTC · Completed 2:35 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $1.26 |
- Fix adjacent quoted phrases fusing tokens by padding replacements
with spaces and normalizing whitespace in the final query string
(e.g. "foo bar""baz qux" now produces "foo bar baz qux")
- Narrow searchOpts type from Record<string, unknown> to an explicit
{ combineWith: string; filter?: ... } for compile-time safety
- Document AND semantics and exact-phrase matching in docs/doc-site.md
- Add test for adjacent quoted phrases edge case
Addresses review feedback on #6799
🔧 Fix agent — iteration 1 (bot-triggered)Addressed all 3 review findings: fixed adjacent-quotes edge case in parseSearchQuery with space-padded replacement and whitespace normalization, narrowed searchOpts type annotation for compile-time safety, and documented AND/phrase search behavior in doc-site.md. Fixed (3):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 2:37 PM UTC · Completed 2:53 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.66 |
Superseded by updated review
|
🤖 Finished Review · ✅ Success · Started 4:47 PM UTC · Completed 5:01 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $3.51 |
- Fix adjacent quoted phrases fusing tokens by padding replacements
with spaces and normalizing whitespace in the final query string
(e.g. "foo bar""baz qux" now produces "foo bar baz qux")
- Narrow searchOpts type from Record<string, unknown> to an explicit
{ combineWith: string; filter?: ... } for compile-time safety
- Document AND semantics and exact-phrase matching in docs/doc-site.md
- Add test for adjacent quoted phrases edge case
Addresses review feedback on #6799
6a93355 to
0934808
Compare
|
🤖 Review · Commit: |
Change `let searchResults` to `const searchResults` to follow the codebase convention of using const for non-reassigned bindings. Addresses #6799
🔧 Fix agent — iteration 4 (bot-triggered)Addressed both review findings: changed let to const for the non-reassigned searchResults variable, and recorded a reasoned disagreement on the observational storeFields memory finding since no remediation was suggested. Fixed (1):
Disagreed (1):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 11:23 AM UTC · Completed 11:37 AM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.29 |
Superseded by updated review
Multi-word queries in the vendored VPLocalSearchBox now require all terms to appear on the same page (combineWith: 'AND') instead of matching any term independently (the MiniSearch default of OR). Quoted phrases like "eval scenario" trigger exact-phrase post-filtering: after the AND search, page modules are rendered and their plain text is checked for the adjacent phrase. Results whose page text cannot be loaded are kept (graceful degradation). Changes: - searchQuery.ts: parseSearchQuery() extracts double-quoted phrases; textContainsPhrases() checks case-insensitive substring matches. - VPLocalSearchBox.vue: search call uses combineWith 'AND', parses query for phrases, post-filters via loadPageText(). - searchQuery.test.ts: 17 unit tests covering query parsing and phrase matching. Closes #6645
- Fix adjacent quoted phrases fusing tokens by padding replacements
with spaces and normalizing whitespace in the final query string
(e.g. "foo bar""baz qux" now produces "foo bar baz qux")
- Narrow searchOpts type from Record<string, unknown> to an explicit
{ combineWith: string; filter?: ... } for compile-time safety
- Document AND semantics and exact-phrase matching in docs/doc-site.md
- Add test for adjacent quoted phrases edge case
Addresses review feedback on #6799
loadPageText() silently failed for every page because VitePress components need runtime context not provided in the detached render. The catch returned "" and graceful degradation kept all results, making the phrase filter a no-op. Replace with filterByPhrases() that checks against the text already stored in the MiniSearch index (added "text" to storeFields). This is synchronous, testable, and doesn't depend on page rendering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move .slice(0, 16) after filterByPhrases so exact-phrase matches beyond MiniSearch rank 16 are not silently discarded before phrase filtering runs. Addresses #6799 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change `let searchResults` to `const searchResults` to follow the codebase convention of using const for non-reassigned bindings. Addresses #6799
1420981 to
71224d0
Compare
|
🤖 Finished Review · ✅ Success · Started 2:42 PM UTC · Completed 2:59 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.07 |
|
Review skipped — this PR is already merged. The Posted by fullsend post-review check |
|
🤖 Finished Retro · ✅ Success · Started 3:00 PM UTC · Completed 3:16 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.24 |
Retro: PR #6799 — AND semantics for docs site multi-word searchThis fully agent-driven PR (code → review → fix, all automated) went through 7 review runs and 3 fix runs over ~49 hours before merge, costing ~$33 in total agent compute. The code agent produced a solid initial implementation, but the review-fix loop was inefficient: roughly 37% of cost went to low or zero-value activities. Key findings
Existing issues with new evidence
Proposals filed
|
Summary
Switches the vendored docs site search (
VPLocalSearchBox.vue) from OR to AND semantics for multi-word queries, so searching foreval scenarioreturns only pages containing both terms. Adds exact-phrase support: wrapping a query in double quotes ("eval scenario") post-filters results to pages where the phrase appears adjacent.Changes
docs/.vitepress/theme/searchQuery.ts— new utility module withparseSearchQuery()(extracts double-quoted phrases) andtextContainsPhrases()(case-insensitive substring check)docs/.vitepress/theme/components/VPLocalSearchBox.vue— passescombineWith: 'AND'toindex.search(); parses query for quoted phrases; addsloadPageText()helper that renders a page module to plain text; post-filters results for exact phrase matches when quotes are presentdocs/.vitepress/theme/searchQuery.test.ts— 17 unit tests covering query parsing edge cases and phrase matchingTesting
vitest runpasses (44 tests, 3 test files)prettier --checkpasses on all changed filesstylelintpasses on the Vue componentmatchesActiveScopes) is preserved — the filter function is merged into the same search options objectCloses #6645
Post-script verification
agent/6645-docs-search-and-semantics)92c1d6498c16ee9fa490150a6405c1bb974aff4a..HEAD)