sqlitematchfts3

Sqlite FTS, Using OR between match operators


When I execute the following query in a sqlite engine (android or sqlitebrowser) it throws an exception that says unable to use function MATCH in the requested context.

select
    a.Body1,
    b.Body2
from
    tbl1_fts  as a,
    tbl2_fts  as b
where
    a.ID = b.ParentID and

    (
        a.Body1 match('value') or
        b.Body2 match('value')
    )

-Both tables have fts.
-Using And operator between two matches (instead of OR) runs normally.

How can I fix this or change the query to find rows with above condition?


Solution

  • you can not use OR Operation, just change your Match Keyword. like SELECT * FROM docs WHERE docs MATCH 'sqlite OR database';

    OR maybe you can use union

    SELECT docid FROM docs WHERE docs MATCH 'sqlite AND database' UNION SELECT docid FROM docs WHERE docs MATCH 'library';