I donβt know if this is a document or an error with SQLite, but here are a few alternatives:
For AND queries
Does not work:
select * from docs where docs match 'sqlite AND database';
Works (using implied AND ):
select * from docs where docs match 'sqlite database';
OR seems to work:
select * from docs where docs match 'sqlite OR database';
For OR + NEAR queries:
Does not work:
SELECT * FROM docs WHERE docs MATCH '(database OR sqlite) NEAR/5 system';
Works:
SELECT * FROM docs WHERE docs MATCH 'database NEAR/5 system' UNION SELECT * FROM docs WHERE docs MATCH 'sqlite NEAR/5 system'
EDIT: for the form specified in the comments (word11 OR word12 OR word13) NEAR/2 (word21 OR word22 OR word23) NEAR/2 (word31 OR word32 OR word33 . This is the best I can do is put all the combinations together with UNION :
SELECT * FROM docs WHERE docs MATCH 'word11 NEAR/2 word21 NEAR/2 word31' UNION SELECT * FROM docs WHERE docs MATCH 'word11 NEAR/2 word22 NEAR/2 word32' UNION SELECT * FROM docs WHERE docs MATCH 'word11 NEAR/2 word23 NEAR/2 word33' UNION SELECT * FROM docs WHERE docs MATCH 'word12 NEAR/2 word21 NEAR/2 word31' ...
The above, of course, creates large amounts of SQL. If your words are alike, then only the final meanings are different, you can use wildcards:
SELECT * FROM docs WHERE docs MATCH 'word1* NEAR/2 word2* NEAR/2 word3*';
source share