mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-12 20:16:15 -08:00
Search normalization splits "A&E" into the 1-letter tokens "a" + "e",
and short first tokens are prefix-anchored for performance (GLOB 'a*'
plus a startsWith gate in the ranking), so provider-prefixed channels
such as "US: A&E" could never match.
Words that keep internal punctuation after edge-trimming ("a&e",
"x-men", "l'equipe") are now preserved as compound words and matched as
an intact substring in addition to the existing token logic:
- global Xtream search supplements the unchanged prefix/GLOB arm with a
trigram FTS substring lookup (MATCH '"a&e"'), deduped by content id,
falling back to the content scan if FTS is unavailable
- the ranking gate lets multi-token phrases match as a space-bounded
whole-word sequence anywhere in the title ("US: A&E", score 40)
without crossing word boundaries ("Casa e Villa" stays excluded)
- per-playlist search and the M3U payload prefilter OR-in intact-word
contains patterns
The pure search-text helpers moved out of content.operations.ts into a
new drizzle-free content-search.util.ts so they are unit-testable
without database mocks; scoreSearchTextMatch is re-exported.
Fixes #1161
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>