6

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?

Mohi
  • 1,776
  • 1
  • 26
  • 39

3 Answers3

1

MATCH as a function would have two parameters:

... WHERE match('value', SomeColumn) ...

However, the usual method of using MATCH is as an operator:

... WHERE SomeColumn MATCH 'value' ...
CL.
  • 173,858
  • 17
  • 217
  • 259
1

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';

Jimmy Chen
  • 177
  • 5
-1

MATCH has to be used without parentheses.

The AND and OR operators must be in capital letters when used with FTS.

Thomas
  • 401
  • 1
  • 6
  • 11