fix: use AND operator in Manticore Content match to prevent OR-token degradation#20
Merged
shukebeta merged 2 commits intoJun 16, 2026
Merged
Conversation
…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>
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
matchfallback inSearchService._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"operator": "and"to the Content match clause — all tokens must be presentmatch_phraseclause is unchanged; notes where tokens appear contiguously still score higherTest plan
dotnet test— 9 tests pass (1 new regression test)operator:"and"is present in the Content match clauseFixes shukebeta/HappyNotes#34
🤖 Generated with Claude Code