Skip to content

feat(search): add opt-in word forms to message search - #242

Merged
neoromantic merged 23 commits into
mainfrom
fix/visible-transcript-forms
Nov 27, 2026
Merged

neoromantic merged 23 commits into
mainfrom
fix/visible-transcript-forms

Conversation

@neoromantic

Copy link
Copy Markdown
Owner

Integrates #216 with its original commits. Closes #92.

Plain searches stay exact. With --forms, Russian and English words can match other forms in the cache. An active chat allowlist keeps expansion off. The release workflow includes the stemmer NOTICE in the binary release, checksums and Homebrew installation.

The final commit makes word forms use the same transcript visibility check as search results. Only current, visible transcripts contribute to the form list, its ranking and its cap. Expansion and results use the same read transaction.

The regression test covers a chat becoming protected, protection being lifted and an attachment being replaced. The regression failed before the fix. Local checks passed, including the search and transcription tests.

ertembiyik and others added 23 commits November 19, 2026 12:48
Plain queries expand to the index's forms of each word. A query with FTS5
syntax or --phrase is matched as written, as before, so the two refusals
of the opt-in flag are gone. The answer has forms (null when the query was
not expanded) and filters.exact.

BREAKING CHANGE: tg messages search returns more results for plain words;
pass --exact for the previous behaviour.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The forms come from the whole cache's vocabulary, so listing them could
show words of chats outside the allowlist. Checking each form against the
allowed chats would read every message with that word, so expansion is
off while a list is set, as with --exact.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
2ms stemmed to 2m, so a search for milliseconds also matched minutes. A
word with a digit or a letter of another script is now matched as typed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The vocabulary lookup reads the folded word, which can be another index
word than the one the tokenizer makes of the typed word (a letter typed
with a combining mark), so the exact match dropped out. Every group now
starts with the word as typed, and the cap of 30 keeps a place for it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
No other word stems to one letter, so scanning every index word with
that first letter only cost time. Two-letter words keep the scan: its
stems to it, and её reads as ее.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…arch-word-forms

# Conflicts:
#	CHANGELOG.md
#	src/commands/messages/search.ts
#	src/db/messages-search.ts

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The FTS5 match built for count, the untyped-match check and the search
that joins transcript hits passed only the phrase option, so it dropped
the word forms: --count disagreed with the results, and forms stopped
working once a transcript matched.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
findQueryForms read only message_search_vocab, so a form that occurs only
in a voice or video note transcript was never searched for. A second
fts5vocab table, transcript_search_vocab, is read together with it,
summing doc per term.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Plain tg messages search matches each word as typed, as 0.16.0 does.
--forms turns word forms on and is refused with FTS5 syntax or --phrase,
as in 17b5bd7; --exact and filters.exact are gone, filters.forms is back.
While allowedChats is set, --forms doesn't expand and forms is null.
The help, docs, skill, changelog and storage.md §9 record the opt-in
choice made in review.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A word whose stem has one or two letters (ok, не) scanned every index word
that starts with its first letter, and a word with no stem (2026) scanned
on its prefix only to keep itself. Both are now exact lookups, the first
with е and ё both, so --forms no longer reads a large part of the
vocabulary before such a search. it no longer finds its.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ormula

The release workflow copies NOTICE into dist, checksums it with the
binaries and uploads it to the GitHub Release. The Homebrew formula takes
it as a resource and installs it in the formula's prefix; tap.sh waits
for it to download before the audit.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@neoromantic
neoromantic merged commit 39f71a5 into main Nov 27, 2026
5 checks passed
@neoromantic
neoromantic deleted the fix/visible-transcript-forms branch November 27, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search: find other word forms without a manual prefix

2 participants