问题
Hi and thanks for looking!
I'm searching for articles which contain certain strings with full text search, something like this:
SELECT * FROM Articles_fts WHERE body MATCH 'monkey OR banana OR "hungry gorilla"';
My real search is much longer (22 terms) and probably not the smartest way of doing this but it's working so no problems there.
What I need help with... Now I want to return the OPPOSITE of what this search returns. In other words I want all the articles that don't contain monkey, banana, or "hungry gorilla".
Thanks very much in advance!
回答1:
NOT is available only when SQLite was compiled with the enhanced FTS query syntax enabled.
Otherwise, you can use SQL set operations to negate the result:
SELECT *
FROM Articles
WHERE id NOT IN (SELECT docid
FROM Articles_fts
WHERE body MATCH '...')
来源:https://stackoverflow.com/questions/28743932/sqlite3-fts-negate-search