diff --git a/src/documents/search/_backend.py b/src/documents/search/_backend.py index 484d6f172..36761c88e 100644 --- a/src/documents/search/_backend.py +++ b/src/documents/search/_backend.py @@ -539,7 +539,7 @@ class TantivyBackend: if note_texts: doc.add_text("notes_text", " ".join(note_texts)) - # Custom fields — JSON for structured queries (custom_fields.name:x, + # Custom fields: JSON for structured queries (custom_fields.name:x, # custom_fields.value:y). There is no companion text field here, unlike # notes: custom field values are reachable only through the JSON field. for cfi in document.custom_fields.all(): diff --git a/src/documents/search/_query.py b/src/documents/search/_query.py index 96623a56c..b38a1121e 100644 --- a/src/documents/search/_query.py +++ b/src/documents/search/_query.py @@ -440,7 +440,7 @@ def parse_user_query( (notes.note:/custom_fields.value:) directly in the registry, via each JSON field's SubpathSpec(default=True). 2. Any diagnostics (bad dates/numbers) map to SearchQueryError subclasses - and raise — the view returns HTTP 400 with every offending field + and raise, the view returns HTTP 400 with every offending field listed, not just the first. 3. emit() turns the AST into a tantivy.Query directly (no string round-trip). A QueryError is routed by its Diagnostic's Cause @@ -450,7 +450,7 @@ def parse_user_query( 4. Optional fuzzy blend (ADVANCED_FUZZY_SEARCH_THRESHOLD) builds a plain word string from the parsed AST's free-text tokens (whoosh_compat.free_text_tokens) and feeds THAT to - index.parse_query — never raw_query, whose whoosh grammar (date + index.parse_query, never raw_query, whose whoosh grammar (date keywords, bracket-class wildcards, etc.) tantivy's parser rejects, which used to silently knock the fuzzy clause out of any mixed query (see _try_parse_fuzzy_query). diff --git a/src/documents/tests/search/test_acceptance.py b/src/documents/tests/search/test_acceptance.py index 1a1557c71..538611028 100644 --- a/src/documents/tests/search/test_acceptance.py +++ b/src/documents/tests/search/test_acceptance.py @@ -1,6 +1,6 @@ """Result-level acceptance corpus: real documents indexed via build_schema(), real queries run through parse_user_query(), matched-document-ID sets -asserted — not intermediate ASTs or query strings. This is paperless-ngx's +asserted, not intermediate ASTs or query strings. This is paperless-ngx's analogue of whoosh-compat's own tests/emitter/test_acceptance_e2e.py. Supersedes test_query.py's TestParseUserQuery result-level cases. @@ -268,7 +268,7 @@ class TestFuzzyBlendSurvivesWhooshGrammar: class TestUnquotedDateKeywordPhrases: """The unquoted spelling (added:previous month) is honored natively by - whoosh-compat's own grammar for this closed phrase vocabulary — no + whoosh-compat's own grammar for this closed phrase vocabulary, no app-level rewrite is involved. Pins that the historically supported spelling keeps working now that paperless no longer pre-quotes it.""" diff --git a/src/documents/tests/search/test_date_keyword_phrase_removal.py b/src/documents/tests/search/test_date_keyword_phrase_removal.py index 06ddb3f3c..069e31dad 100644 --- a/src/documents/tests/search/test_date_keyword_phrase_removal.py +++ b/src/documents/tests/search/test_date_keyword_phrase_removal.py @@ -3,7 +3,7 @@ _quote_date_keyword_phrases rewrite. That rewrite matched date-keyword phrases (e.g. "previous month" after a date field) anywhere in the raw query string, including inside an -unrelated quoted string, and inserted quotes mid-phrase there too — its +unrelated quoted string, and inserted quotes mid-phrase there too. Its own docstring gave ``title:"see added:previous month notes"`` as the example of what it corrupted. whoosh-compat's grammar accepts the same phrase vocabulary unquoted natively (see TestUnquotedDateKeywordPhrases diff --git a/src/documents/tests/search/test_query.py b/src/documents/tests/search/test_query.py index 8b2962542..e1b49e767 100644 --- a/src/documents/tests/search/test_query.py +++ b/src/documents/tests/search/test_query.py @@ -119,7 +119,7 @@ class TestParseUserQuery: query_index: tantivy.Index, ) -> None: # parse_user_query never falls back to the raw query string on a parse - # error — a bad date diagnostic from whoosh-compat always maps to an + # error: a bad date diagnostic from whoosh-compat always maps to an # InvalidDateQuery and must propagate, so the view can return a 400 # instead of silently parsing the raw (invalid) date. with pytest.raises(InvalidDateQuery) as exc_info: @@ -154,7 +154,7 @@ class TestParseUserQuery: self, query_index: tantivy.Index, ) -> None: - # tag_id is intentionally excluded from the FieldRegistry — whoosh-compat + # tag_id is intentionally excluded from the FieldRegistry: whoosh-compat # parity leniency folds it into literal text, not a diagnostic/400. # A result-level assertion that this fold actually matches nothing # against real documents lives in