I want to search for SELECT *from email_fts WHERE email_fts MATCH’ to: “[email protected]” or from: “[email protected]”‘
Thanks in advance ,
Mano
CREATE VIRTUAL TABLE email_fts USING fts3(subject, body, "to", "from");
Then you can search for a single FTS column:
SELECT rowid
FROM email_fts
WHERE "to" MATCH'[email protected]'
UNION
SELECT rowid
FROM email_fts
WHERE "from" MATCH'[email protected]'
Edit: My previous answer is in the WHERE clause There is an OR. Obviously SQLite does not support combining OR queries with MATCH conditions. The above union is valid.
The FTS document is here, and this is one of the examples used in the document.
http://sqlite.org/fts3.html
Is there a way to search for a specific string in a column?
I want to search for SELECT *from email_fts WHERE email_fts MATCH’ to: “[email protected]” or from: “[email protected]”‘
Thanks in advance ,
Mano
Make sure to create the correct FTS column in the FTS index:
< /p>
CREATE VIRTUAL TABLE email_fts USING fts3(subject, body, "to", "from");
Then you can search for a single FTS column:
p>
SELECT rowid
FROM email_fts
WHERE "to" MATCH'[email protected]'
UNION
SELECT rowid
FROM email_fts
WHERE "from" MATCH'[email protected]'
Edit: My previous answer has an OR in the WHERE clause. Obviously sqlite does not support OR query with MATCH conditions are combined. The above unions are valid.
The FTS document is here, this is one of the examples used in the document.
http://sqlite.org/fts3.html< /p>