Compare commits

...
Author SHA1 Message Date
stumpylog 6fc9867465 Chore(deps): Update tantivy to 0.27 and rebuild the search index
The new stemmer changes some stems (university, added, organization), so bump SCHEMA_VERSION to force a reindex. Update the wildcard test and docs that relied on the old stems.
2026-12-01 13:09:17 -08:00
stumpylog 1b2b635090 Chore(deps): Raise Python dependency constraints
Raise the upper bounds holding back celery, imap-tools, torch, turbohtml, faker, pytest and pytest-randomly, and take a few patch releases.
2026-12-01 13:09:17 -08:00
stumpylog 9a6b0b092f Chore(deps): Update Python dependencies by hand
Dependabot's Python updates are not running, so bump the low risk packages, including the Django 5.2.19 security release, with uv lock --upgrade-package.
2026-12-01 13:09:17 -08:00
6 changed files with 542 additions and 527 deletions

No files matched your search

+1 -1
View File
@@ -1115,7 +1115,7 @@ title:Invoice*
!!! note
When a [stemmer is available](configuration.md#PAPERLESS_SEARCH_LANGUAGE) for your search language, words are indexed by their stem, so `copy*` also finds "copies". A prefix that runs past the stem can find nothing: `universit*` misses "university", which is stored as `univers`. If a wildcard finds nothing, try a shorter prefix, such as `univers*`.
When a [stemmer is available](configuration.md#PAPERLESS_SEARCH_LANGUAGE) for your search language, words are indexed by their stem, so `copy*` also finds "copies". A prefix that runs past the stem can find nothing: `organizat*` misses "organization", which is stored as `organiz`. If a wildcard finds nothing, try a shorter prefix, such as `organi*`.
#### Searching by date
+9 -9
View File
@@ -19,7 +19,7 @@ classifiers = [
dependencies = [
"azure-ai-documentintelligence>=1.0.2",
"babel>=2.17",
"celery[redis]~=5.6.2",
"celery[redis]~=5.7.0",
"channels~=4.2",
"channels-redis~=4.2",
"concurrent-log-handler~=0.9.25",
@@ -27,7 +27,7 @@ dependencies = [
"dateparser~=1.4",
# WARNING: django does not use semver.
# Only patch versions are guaranteed to not introduce breaking changes.
"django~=5.2.18",
"django~=5.2.19",
"django-allauth[mfa,socialaccount]~=65.21.1",
"django-auditlog~=3.4.1",
"django-cachalot~=2.9.0",
@@ -49,7 +49,7 @@ dependencies = [
"httpx-oauth~=0.17",
"humanize>=4.15",
"ijson>=3.5.1",
"imap-tools>=1.14,<1.16",
"imap-tools>=1.14,<1.17",
"jinja2~=3.1.6",
"langdetect~=1.0.9",
"llama-index-core>=0.14.23",
@@ -77,10 +77,10 @@ dependencies = [
"sentence-transformers>=5.6.1",
"setproctitle~=1.3.4",
"sqlite-vec==0.1.10+paperless.3",
"tantivy~=0.26.0",
"tantivy~=0.27.0",
"tika-client[httpx]~=1.0",
"torch>=2.13,<2.15",
"turbohtml~=1.15.3",
"torch>=2.13,<2.16",
"turbohtml~=1.16.0",
"watchfiles>=1.2",
"whitenoise~=6.11",
"whoosh-compat[tantivy]==0.3",
@@ -116,15 +116,15 @@ lint = [
testing = [
"daphne",
"factory-boy~=3.3.1",
"faker>=40.36,<40.44",
"faker>=40.36,<40.64",
"imagehash",
"pytest~=9.1.1",
"pytest~=9.2.0",
"pytest-cov~=7.1.0",
"pytest-django>=4.12,<4.15",
"pytest-env~=1.8.1",
"pytest-httpx",
"pytest-mock~=3.17.0",
"pytest-randomly~=5.0.0",
"pytest-randomly~=5.1.0",
"pytest-rerunfailures~=16.4",
"pytest-sugar",
"pytest-xdist~=3.8.0",
+3 -1
View File
@@ -30,7 +30,9 @@ logger = logging.getLogger("paperless.search")
# v3 - barcodes JSON field for stored barcode contents
# v4 - root documents only. Earlier indexes may hold document versions under
# their own id and metadata, so they are rebuilt without them.
SCHEMA_VERSION: Final[int] = 4
# v5 - tantivy 0.27 replaced its Snowball English stemmer, so stored terms such
# as "univers" (now "universiti") no longer match what a query stems to.
SCHEMA_VERSION: Final[int] = 5
# Present in the index directory from the moment a full rebuild starts until it
# finishes. If a rebuild is interrupted it is left behind, so the half-built
@@ -42,9 +42,9 @@ class TestFuzzyClauseWords:
THEN:
- Only the correctly-spelled document and its typo match; the
clause does not widen far enough to reach the unrelated
words. 'universities' stems to 'univers'; feeding that back
to tantivy would stem it again to 'univ', whose fuzzy prefix
reaches unrelated words - the clause must stay wide enough
words. 'universities' stems to 'universiti'; a stem fed back
to tantivy is stemmed a second time, which can shorten it
further and widen its fuzzy prefix to unrelated words - the clause must stay wide enough
for a typo and no wider
"""
wanted = index_document(
@@ -110,8 +110,8 @@ class TestPrefixStemming:
path to do it: measured under "en", the stemmer leaves
"librar" alone, so it has one form, and that form is a
prefix of the "librari" the index holds for "library";
"univers" stems to the *shorter* "univ", and the run as
typed and its stem are both prefixes of the "univers" the
"univers" stems to the *shorter* "univer", and the run as
typed and its stem are both prefixes of the "universiti" the
index holds for "university". The case where the two forms
genuinely diverge, and only one of them matches, is
test_stem_substitution_reaches_both_the_inflection_and_the_compound
@@ -125,21 +125,21 @@ class TestPrefixStemming:
) -> None:
"""
GIVEN:
- The same indexed document, storing "university" as "univers"
- The same indexed document, storing "electricity" as "electr"
WHEN:
- "universities*", "universit*" and "univers*" are each queried
- "electricity*", "electri*" and "electr*" are each queried
THEN:
- "universities*" matches, since the stem of "universities" is
that same "univers"; "universit*" matches nothing, since
"universit" is a prefix of neither its own stem nor the
- "electricity*" matches, since the stem of "electricity" is
that same "electr"; "electri*" matches nothing, since
"electri" is a prefix of neither its own stem nor the
stored term. The alternatives widen recall without turning
a wildcard into a prefix search over the original text.
usage.md tells a reader whose `universit*` finds nothing to
shorten it to `univers*`, which matches
usage.md tells a reader whose `electri*` finds nothing to
shorten it to `electr*`, which matches
"""
assert matched_ids("universities*") == {indexed_doc.id}
assert matched_ids("universit*") == set()
assert matched_ids("univers*") == {indexed_doc.id}
assert matched_ids("electricity*") == {indexed_doc.id}
assert matched_ids("electri*") == set()
assert matched_ids("electr*") == {indexed_doc.id}
def test_pattern_past_the_stem_boundary_is_documented_not_fixed(
self,
Generated
+514 -501
View File
File diff suppressed because it is too large. Load diff