SQLite Forum

Word search in FTS5

Word search in FTS5

(1) By Spaced Cowboy (SpacedCowboy) on 2020-08-16 18:22:36 [source]

Anyone got any hints for how to do a word-search query in FTS5 ?

Basically I want the results to match the start of words, so if I present 's' as the input, then I only get back rows that have words starting with 's'. If I then present 'st' as the input, I only get back words starting with 'st' etc.

I tried presenting ' s', but of course the tokenizer strips out the ' ' character, so that won't work.

(2) By Simon Willison (simonw) on 2020-08-28 06:23:01 in reply to 1 [link] [source]

SQLite FTS supports suffix wildcards, so running WHERE body MATCH 'st*' should do what you want.