Skip to content

fix: use AND operator in Manticore Content match to prevent OR-token degradation#20

Merged
shukebeta merged 2 commits into
masterfrom
fix/issue-happynotes-34-manticore-phrase-matching
Jun 16, 2026
Merged

fix: use AND operator in Manticore Content match to prevent OR-token degradation#20
shukebeta merged 2 commits into
masterfrom
fix/issue-happynotes-34-manticore-phrase-matching

Conversation

@shukebeta

Copy link
Copy Markdown
Owner

Summary

  • The Content match fallback in SearchService._BuildNoteSearchQuery() previously used Manticore's default OR semantics, causing multi-token CJK queries to return notes that contain any single token rather than all tokens
  • Adds "operator": "and" to the Content match clause — all tokens must be present
  • The boosted match_phrase clause is unchanged; notes where tokens appear contiguously still score higher

Test plan

  • dotnet test — 9 tests pass (1 new regression test)
  • New test: captures request body and asserts operator:"and" is present in the Content match clause

Fixes shukebeta/HappyNotes#34

🤖 Generated with Claude Code

shukebeta and others added 2 commits June 16, 2026 20:37
…degradation

The Content "match" fallback in _BuildNoteSearchQuery used default OR
semantics, so a CJK query like "小菜园 浇水" matched notes containing any
single token bigram ("小菜", "菜园", "浇水"), flooding results with
irrelevant hits after page 1.

Adds operator:"and" to the Content match clause so all tokens must be
present. The boosted match_phrase clause is unchanged; notes where the
tokens appear as a contiguous phrase still score higher.

Adds a regression test that captures the HTTP request body and asserts
the operator field is present and equals "and".

Fixes shukebeta/HappyNotes#34

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Review found the Tags match clause still used default OR semantics after
the Content AND fix, allowing a note to surface via a partially-matching
tag even when the Content match requires all tokens. Both clauses now
use operator:\"and\". Updated the regression test to verify both fields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shukebeta shukebeta merged commit 6d15e64 into master Jun 16, 2026
6 checks passed
@shukebeta shukebeta deleted the fix/issue-happynotes-34-manticore-phrase-matching branch June 16, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: Improve Manticore search quality by using phrase matching per token

1 participant