Skip to content

fix(search): use implicit AND in FTS queries, not the AND keyword - #6

Merged
PonceGL merged 1 commit into
devfrom
bugfix/fts-multiword-search-and-keyword
Aug 6, 2026
Merged

fix(search): use implicit AND in FTS queries, not the AND keyword#6
PonceGL merged 1 commit into
devfrom
bugfix/fts-multiword-search-and-keyword

Conversation

@PonceGL

@PonceGL PonceGL commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Integrates PR PixelPlayerHQ#2706 (open against upstream/master) into dev.

buildSongSearchMatchQuery/buildSongTitleSearchMatchQuery joined query
tokens with the literal " AND " keyword (e.g. "que* AND ganas*").
That keyword only behaves as a boolean operator on SQLite builds
compiled with SQLITE_ENABLE_FTS3_PARENTHESIS - not guaranteed on every
Android device. Without it, "AND" is parsed as an ordinary search
term, so a multi-word query would only match rows that literally
contained the word "and", silently breaking multi-word search
entirely on affected devices.

Confirmed on a real device (Galaxy S25 Ultra, SQLite 3.44.5, no
FTS3_PARENTHESIS support): searching a two-word query against a title
that doesn't contain "and" returned zero results, regardless of case
or accents, while the exact same content was trivially findable via a
single-token query or via the always-available implicit-AND syntax
(space-separated terms, no keyword).

Fix: join tokens with a plain space instead. Implicit AND is base FTS3/4
syntax, supported unconditionally on every SQLite build. Also extracts
the shared tokenization logic into one helper (buildFtsMatchQuery) to
remove the duplication between the two query builders.

Adds MusicDaoQueryBuilderTest (unit, verifies the query string shape)
and a MusicDaoTest regression case that runs the real query against a
real FTS4 table - which is what actually caught this, since a plain
string-comparison test wouldn't exercise the SQLite engine at all.
@PonceGL
PonceGL merged commit e25c445 into dev Aug 6, 2026
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.

1 participant