mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-08-19 17:23:21 +00:00
fix(search): restore unquoted multi-word date keywords via pre-parse quoting
"added:previous month" returned HTTP 400 after the whoosh-compat migration. The unquoted spelling was never parser-native anywhere: v2 rewrote it to explicit bracket ranges app-side before whoosh saw the string, and the deleted translation layer consumed it itself, so users and saved views have relied on it continuously while whoosh-compat deliberately scopes it out of its parser (its DIVERGENCES.md entry 19) and understands the phrases natively only as quoted values. parse_user_query now quotes the closed six-phrase vocabulary (previous week/month/quarter/year, this month/year) when it directly follows a date field's colon, before parsing. Only quoting happens app-side; every date computation stays in whoosh-compat's grammar, unlike v2's rewrite, which computed the ranges itself. Date field names derive from PUBLIC_FIELDS, the field name matches case-sensitively (the parser's own field tagging is case-sensitive), the phrase case-insensitively (the grammar accepts any case in the quoted form), and already-quoted spellings, TEXT fields, unfielded words and bracketed ranges are untouched. The previously xfailed end-to-end regression test now passes as a plain test, and a new acceptance class pins unquoted == quoted == mixed-case result sets on a boundary fixture, no-error parsing for the whole vocabulary across all three date fields, and that "title:previous month" stays an ordinary text search. docs/usage.md now states the two spellings are equivalent after a date field. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WMsn6DgzbvSqh1pwy66VVF
This commit is contained in:
co-authored by
Claude Fable 5
parent
a717684a60
commit
7bab9622c8
+3
-2
@@ -923,8 +923,9 @@ produ*name
|
||||
|
||||
Matching natural date keywords:
|
||||
|
||||
Multi-word date keywords must be quoted (e.g. `added:"previous month"`); an
|
||||
unquoted multi-word keyword is not recognized as a date keyword.
|
||||
Multi-word date keywords work quoted or unquoted after a date field
|
||||
(`added:"previous month"` and `added:previous month` are equivalent);
|
||||
elsewhere in a query the same words are treated as ordinary search text.
|
||||
|
||||
```
|
||||
added:today
|
||||
|
||||
Reference in New Issue
Block a user