mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-08-26 20:53:20 +00:00
The wildcard caveat still described the pre-alternatives world: "where stemming shortens a word, a pattern that reaches past the point it was cut off matches nothing". Measured against a real index that is false for most of the set it ranges over. university*, companie*, happiness* and universities* all match, because the stem of the typed run is offered as a second branch. Only a fragment landing strictly between the stem and the surface form fails, which is what both of the examples happened to be, so the sentence read as convincing. A user who believed it would type a shorter fragment, which genuinely finds nothing, instead of the full word, which works. The rule stated now is the measured one: a trailing * matches a stored term when either the run as typed or its stem is a prefix of that term. Both branches are load-bearing, verified one word per document. copy* reaches "copies" only via the stem and "copyright" only via the surface form, so a rule naming just the stem would predict the wrong answer for half of it. Also corrects two more claims that were each defensible alone and wrong together, both measured before rewriting: - checksum patterns are lowercased even though checksum terms are stored verbatim, so checksum:9F86D081* does match; "matched exactly as typed and nothing else" told the reader otherwise. Pinned as a positive case beside the uppercase *term* that really does fail. - relative offsets and long-form dates must be quoted only as a value standing alone; added:[-1 week to now] works unquoted and returns the same documents as the quoted spelling. test_pattern_stemming.py's partial-prefix docstring was fabricated: it said "librar" stems to the longer "librari" and so matches nothing on its own. Measured, the stemmer leaves "librar" alone, "univers" stems to the shorter "univ", and librari* does match this file's own fixture. Rewritten against measured values, and renamed, since a future editor reasoning from it would have believed these params exercise the two-alternative path. They do not, so a regression breaking that path would have left them green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>