Commit Graph
11900 Commits
Author SHA1 Message Date
Trenton HolmesandClaude Sonnet 5 970730394e docs: drop *_id field-removal note from usage.md
These prefixes were never documented public API (undocumented internal
fields the old KNOWN_FIELDS happened to accept), so their removal isn't a
user-facing regression worth calling out in usage.md. The behavior is still
covered by test_acceptance.py's TestUnregisteredIdFieldFoldsToLiteralText.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RVj8NFy821G3YhNf68PF6X
2026-08-18 11:05:04 -07:00
Trenton HolmesandClaude Sonnet 5 9f0e4c6d89 test(search): add result-level coverage for RFC3339 T/Z date-range queries
A prior commit deleted test_query.py's parametrized "doesn't raise" coverage
for this shape (created:[...T...Z TO ...] and comma-combined ranges), which
was also the only place PR #13010's T/Z backward-compat guarantee was
exercised. Nothing in paperless's suite proved the full parse_user_query() ->
tantivy Query -> matched-document pipeline still honors it after the
whoosh-compat grammar fix (commit f936143 in the whoosh-compat repo). Add
result-level acceptance cases: an in/out-of-range T/Z bracket range, PR
#13010's original comma-combined two-field shape, and an exact-boundary case
proving a Z-suffixed bound is absolute UTC, not shifted by the local search
timezone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RVj8NFy821G3YhNf68PF6X
2026-08-18 11:05:04 -07:00
Trenton Holmes 0bf06f89a7 refactor: minor cleanup from final whoosh-compat migration review
- Update stale test comments in test_query.py that described string
  rewriting / raw-query fallback behavior that no longer exists post
  whoosh-compat migration; rename
  test_date_rewriting_applied_before_tantivy_parse to
  test_date_keyword_resolves_without_raising to match.
- views.py: move the local MultipleSearchQueryErrors import up into the
  existing local-import block near the top of list(), consistent with
  the other documents.search imports there, instead of importing it
  again inside the except SearchQueryError clause.
- test_api_search.py: assert response.status_code explicitly before
  indexing into response.data["results"] in
  test_search_added_previous_month_excludes_next_period_start, and tie
  the xfail marker to AssertionError instead of the incidental KeyError
  that indexing a 400 response's missing "results" key produced.
2026-08-18 11:05:04 -07:00
Trenton Holmes a66237f614 docs: clarify quoted date-keyword phrases and dropped *_id field aliases
Add a sentence to the "Supported date keywords" advanced-search section
noting that multi-word date keywords must be quoted (e.g.
added:"previous month") -- whoosh-compat requires quoting where the
unquoted form used to work. Also document that the old undocumented
*_id field aliases (tag_id, owner_id, viewer_id, correspondent_id,
document_type_id, storage_path_id, type_id, path_id) are no longer
recognized: a query using one now silently folds to a literal-text
search instead of matching the intended structured field.
2026-08-18 11:05:04 -07:00
Trenton Holmes b48b1a7d08 test: assert unregistered id-field queries actually match nothing
test_unregistered_id_field_folds_to_literal_text_not_error only checked
that parse_user_query() didn't raise for a query like tag_id:5. Add a
result-level acceptance test (matching test_acceptance.py's
_matched_ids pattern, indexed against real documents) that asserts the
matched-document-ID set is genuinely empty, not just that the parse
step succeeds.
2026-08-18 11:05:04 -07:00
Trenton Holmes eaa6dc1eed fix: skip fuzzy search blend when raw query isn't tantivy-parseable
The fuzzy blend clause in parse_user_query() fed the raw, whoosh-syntax
query string directly to tantivy's own query parser. Since the
whoosh-compat migration, raw_query still contains whoosh grammar (date
keywords, whoosh-style ranges, bracket-class wildcards) that tantivy's
parser rejects with ValueError, which escaped parse_user_query and
turned into a generic HTTP 400 for the entire query whenever
ADVANCED_FUZZY_SEARCH_THRESHOLD was configured.

Deriving a clean plain-text-only extraction for the fuzzy clause was
ruled out: wc.parse() already expands unfielded terms into per-default-
field copies in the AST, so there's no "still unfielded" marker left to
walk without duplicating whoosh-compat's own expansion logic. Instead,
scope a narrow try/except ValueError around exactly the
index.parse_query() call and skip the fuzzy clause (logged at debug)
when it can't parse, leaving the exact/CJK clauses unaffected.
2026-08-18 11:05:04 -07:00
Trenton Holmes d779a1437a docs: document asn/page_count/checksum/original_filename advanced search fields 2026-08-18 11:05:04 -07:00
Trenton Holmes a0de357ae9 refactor(search): delete _translate.py/_dates.py, superseded by whoosh-compat 2026-08-18 11:05:04 -07:00
Trenton Holmes 5942cfb860 test(api): add end-to-end search coverage for asn/page_count/original_filename/checksum 2026-08-18 11:05:04 -07:00
Trenton Holmes 846c6f88ee test(search): add result-level acceptance corpus, trim internals-only test_query.py classes
Replaces test_query.py's intermediate-AST/query-string checks with a
result-level acceptance corpus that indexes real documents and asserts
matched-ID sets through parse_user_query(), covering the #13568
bracket-wildcard regression, comma value lists, field boosts, JSON subpaths,
and Multitoken-in-OR nesting. Removes TestCreatedDateField, TestDateTimeFields,
TestWhooshQueryRewriting, TestYearRangeRewriting, TestNonDateFieldsNotRewritten,
TestPassthrough, TestNormalizeQuery, and TestParseUserQuery's
test_advanced_search_queries_do_not_raise from test_query.py, since they test
translate_query/_dates.py internals or a diagnostics-free-parse guarantee
whoosh-compat's own suite already covers.
2026-08-18 11:05:04 -07:00
Trenton HolmesandClaude Sonnet 5 bb157726c9 feat(api): surface every search query error, not just the first
When parse_user_query() raises MultipleSearchQueryErrors due to multiple
field parsing failures (e.g. both an invalid date and an invalid number
in a single query), the exception handler now surfaces all error messages
in the 400 response, allowing users to fix them all in one round-trip
instead of discovering them one at a time.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 11:05:04 -07:00
Trenton Holmes 0353b04f4b Chore: remove obsolete xfail for RFC3339 T/Z date-range queries
whoosh-compat's date grammar now accepts "T" as a date/time separator
and a trailing "Z" UTC designator (paperless-ngx PR #13010
back-compat), so these advanced-search queries no longer raise.
2026-08-18 11:05:04 -07:00
Trenton HolmesandClaude Sonnet 5 d7ccff138b feat(search): route parse_user_query through whoosh-compat
Rewires parse_user_query() to parse via wc.parse()/tantivy_emit() against
the shared FieldRegistry instead of the string-based translate_query()
pipeline, so diagnostics map to typed SearchQueryError subclasses
(InvalidDateQuery/InvalidNumberQuery/MultipleSearchQueryErrors) and every
bad field is reported, not just the first.

Marks three pre-existing tests xfail (2 in test_query.py, 1 in
test_api_search.py) for confirmed whoosh-compat grammar gaps found while
verifying this rewrite: unquoted multi-word date keywords (e.g.
`added:previous month`) and RFC3339 T/Z datetime range bounds no longer
parse.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 11:05:04 -07:00
Trenton HolmesandClaude Sonnet 5 4577a0a00a refactor(search): move SearchQueryError family to _query.py, add InvalidNumberQuery/MultipleSearchQueryErrors
Move SearchQueryError and InvalidDateQuery from _translate.py to _query.py and
add two new exception classes: InvalidNumberQuery and MultipleSearchQueryErrors.
Update _translate.py to re-export the exceptions for backward compatibility
until the translation module is removed. Update __init__.py to export all
four exception classes from _query.py.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 11:05:04 -07:00
Trenton Holmes f6090fe5d4 test(search): add transitional date-grammar parity audit against whoosh-compat 2026-08-18 11:05:04 -07:00
Trenton Holmes d4e88d2e88 test(search): guard JSON subpath/dict-key coupling between _fields.py and _backend.py 2026-08-18 11:05:04 -07:00
Trenton Holmes bc5360cd6b feat(search): add whoosh-compat FieldRegistry construction 2026-08-18 11:05:04 -07:00
Trenton HolmesandClaude Sonnet 5 d0e93790ce build: add whoosh-compat as a local-path dependency
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 11:05:04 -07:00
Trenton Holmes 5e8a607d87 refactor(search): derive build_schema() from shared PUBLIC_FIELDS table 2026-08-18 11:04:05 -07:00
Trenton HolmesandClaude Sonnet 5 876db6d744 feat(search): add shared PUBLIC_FIELDS table
Create the shared field-definition table consumed by the schema builder
(_schema.py) and the whoosh-compat field registry (_registry.py). This
eliminates drift between what the index exposes and what queries can address.

- Create PublicField frozen dataclass with field metadata
- Define PUBLIC_FIELDS tuple with 16 searchable fields
- Add comprehensive test suite covering field properties

The whoosh-compat pyproject.toml dependency addition is added in a
follow-up commit, with the correct [tantivy] extra, source comment, and a
matching uv.lock update.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 11:04:05 -07:00
stumpylog 0042b0c4f7 Updates after reviewing and updating compat lirary 2026-08-18 11:04:05 -07:00
stumpylog 93f018b87d docs: flag where the transition spec and plan describe a moved API
The library changed after these were written and more changes are already
decided upstream. Records what is wrong today, what to write toward, the
one question still open, and the fast-JSON-field trap, rather than
silently leaving code that would fail on contact.
2026-08-18 11:04:05 -07:00
stumpylog da7d486ff3 chore: update transition guidance for the current whoosh-compat API
Field references became a typed value rather than a dotted string, so
diagnostics carry one too and the registry exposes a single resolver.
Also records that the JSON fields must stay non-fast while existence
checks against a fast JSON field return inverted results.
2026-08-18 11:04:05 -07:00
stumpylogandClaude Fable 5 abae0c74fb chore: build typed search errors from structured diagnostic data
Diagnostics now carry field and raw_value, so the transition guidance
points at those instead of parsing human-readable message text.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 11:04:05 -07:00
stumpylogandClaude Sonnet 5 35d688be78 docs: add whoosh-compat transition implementation plan
16 bite-sized, TDD tasks across the design spec's 4-PR stack, each with
a suggested subagent type/model for delegated execution. Test/fixture
code in the acceptance-corpus and API-expansion tasks was verified
against the real codebase (documents/tests/search/conftest.py's
existing backend/index fixtures, test_backend.py's pytestmark
convention, CustomFieldInstance's typed value_text field) rather than
guessed, and the date-grammar parity test's AST-shape assumption was
confirmed by actually running whoosh_compat.parse() against a real
DATE FieldRegistry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 11:04:05 -07:00
stumpylogandClaude Sonnet 5 b26c7fb05f docs: fold agent-review findings into whoosh-compat transition spec
Agent review (source-verified against both repos) confirmed the spec's
claims accurate throughout, with one real gap: the JSON-subpath
tantivy-py carve-out (index.parse_query fallback for notes.*/
custom_fields.* until tantivy-py#716 ships) interacts with paperless's
pinned tantivy~=0.26.0 and wasn't mentioned. Also added two footnotes:
FieldRegistry forces date_only=True on any DATE spec regardless of the
PublicField default, and the date-grammar parity audit implicitly
grants new keyword vocabulary as a side effect.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 11:04:05 -07:00
stumpylogandClaude Sonnet 5 a50923c89d docs: add whoosh-compat transition design spec
Design for replacing _translate.py/_dates.py with whoosh-compat: shared
field-definition table driving both the Tantivy schema and the query
FieldRegistry, diagnostics->exception mapping (aggregating all errors,
not just the first), a 4-PR stack with no rollout flag, and a
result-level acceptance corpus + date-grammar parity audit as the
safety net instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 11:04:04 -07:00
stumpylogandClaude Fable 5 bb5c2407c6 chore: add whoosh-compat transition skill
Encodes the settled integration decisions for replacing the
hand-maintained search translation layer with whoosh-compat:
user-typed query surface policy, analyzer seam, diagnostics-before-emit
contract, mandatory date parity audit, test churn, and rollout plan.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-18 11:04:04 -07:00
shamoon 4cf027de40 Tweak: space out the side menu sub-nav a bit 2026-08-18 09:44:03 -07:00
shamoon 41953c7846 Chore: harden ImageMagick policy 2026-08-18 09:38:54 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
e5abe5cf32 Chore(deps): Bump the uv group across 1 directory with 2 updates (#13709)
Bumps the uv group with 2 updates in the / directory: [pymdown-extensions](https://github.com/facelessuser/pymdown-extensions) and [sqlparse](https://github.com/andialbrecht/sqlparse).


Updates `pymdown-extensions` from 11.0 to 11.0.1
- [Release notes](https://github.com/facelessuser/pymdown-extensions/releases)
- [Commits](https://github.com/facelessuser/pymdown-extensions/compare/11.0...11.0.1)

Updates `sqlparse` from 0.5.5 to 0.6.0
- [Changelog](https://github.com/andialbrecht/sqlparse/blob/master/CHANGELOG)
- [Commits](https://github.com/andialbrecht/sqlparse/compare/0.5.5...0.6.0)

---
updated-dependencies:
- dependency-name: pymdown-extensions
  dependency-version: 11.0.1
  dependency-type: indirect
- dependency-name: sqlparse
  dependency-version: 0.6.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-18 15:11:24 +00:00
shamoonandGitHub 643d0205bc Fix: dont re-render path template when checking collisions (#13718) 2026-08-18 07:19:51 -07:00
GitHub Actions 2865a095b0 Auto translate strings 2026-08-18 07:52:35 +00:00
shamoonandGitHub f0eb77c405 Chore: update, reorg some npm deps (#13716) 2026-08-18 00:50:58 -07:00
shamoonandGitHub e5cc7c6c40 Chore: complete pnpm 11 switch on ci (#13713) 2026-08-18 00:19:49 -07:00
shamoonandGitHub f2806179a2 Fix: DocumentClassifierSchema bounds (#13707) 2026-08-17 09:58:35 -07:00
shamoon 36c736a9f9 Drop this 2026-08-16 20:13:35 -07:00
GitHub Actions be35079d54 Auto translate strings 2026-08-16 23:06:11 +00:00
shamoon a75465b734 Fix: fix trash double-bottom border 2026-08-16 16:04:27 -07:00
shamoon 0af1e41753 Fix: fix modal create closing open dropdown 2026-08-16 15:51:36 -07:00
GitHub Actions d88b281eb2 Auto translate strings 2026-08-16 06:14:38 +00:00
shamoonandGitHub 8446036777 Tweak: small visual tweaks / improvements & fixes (#13700) 2026-08-15 23:12:51 -07:00
shamoonandGitHub 8ad5e8cca3 Fix: remove shadow around attribute pages (#13696) 2026-08-15 11:32:23 -07:00
shamoonandGitHub 1606a46b53 Zen: correct dropdown corner radius visual defect (#13695) 2026-08-15 10:41:54 -07:00
shamoonandGitHub f647f304da Fix: handle Android keyboard popper overlay (#13694) 2026-08-15 09:42:59 -07:00
GitHub Actions 31746371f4 Auto translate strings 2026-08-14 22:53:12 +00:00
Trenton HandGitHub 0e5fbc973a Enhancement: prefer existing tags, types, correspondents, and storage paths in AI suggestions (#13676)
AI Suggestions previously invented near-duplicate metadata because the classification
prompt had no knowledge of the installation's own taxonomy. This surfaces
a small, ranked, permission-filtered set of existing tags/document
types/correspondents/storage paths - drawn from the document's RAG
neighbors plus its own already-assigned metadata - so the model prefers
reusing what already exists.

The LLM response schema now returns existing_ids (IDs of reused
candidates) separately from new_names (genuinely new suggestions).
Only new_names goes through localization and fuzzy name-matching;
existing_ids is resolved deterministically and never touched by the
localization pass, so exact matches can no longer be silently
corrupted by translation.
2026-08-14 15:51:34 -07:00
GitHub Actions 3322c92837 Auto translate strings 2026-08-14 18:46:35 +00:00
shamoonandGitHub db15c82804 Fix: only show create when there is text, hide set values if no fields in cf bulk edit dropdown (#13688) 2026-08-14 11:43:45 -07:00
Trenton HandGitHub fe5d09a123 Fix: reopen a fresh Tantivy index per write to prevent orphaned segment files (#13682) 2026-08-14 16:21:15 +00:00