jakk
jakk

Reputation: 1213

sqlite match operator

On Android i would like to use a query similar to this:

SELECT docid FROM docs WHERE docs MATCH '("sqlite database" OR "sqlite library") AND linux'

http://www.sqlite.org/fts3.html#section_3

The problem is that I got a "malformed match expression error". When I do more basic match query it works, and it seems the issue might be because of the parentheses.

When I use exactly the same statement (except the table the column name) the error is the same.

The complete error message:

sqlite returned: error code = 1, msg = statement aborts at 7: 
[SELECT * FROM namedays WHERE names MATCH '("sqlite database" OR "sqlite library") AND linux';]
malformed MATCH expression: [("sqlite database" OR "sqlite library") AND linux], db=/data/data/org.xyz/databases/data

Any idea?

Upvotes: 0

Views: 2382

Answers (1)

user610650
user610650

Reputation:

I believe you do not have SQLite compiled with the SQLITE_ENABLE_FTS3_PARENTHESIS option. As such, you can only use the Standard Query Syntax, not the Enhanced Query Syntax

You can easily verify this by executing the compile_options pragma. For example, we see that my sqlite3 doesn't have the enhanced syntax:

sqlite> PRAGMA compile_options;
DISABLE_DIRSYNC
ENABLE_COLUMN_METADATA
ENABLE_FTS3
ENABLE_RTREE
ENABLE_UNLOCK_NOTIFY
SECURE_DELETE
TEMP_STORE=1
THREADSAFE=1

Upvotes: 4

Related Questions