Reputation: 3687
I am trying to query a Sqlite database taking into account 2 fields, say title and author, with the following query:
SELECT * FROM books WHERE title MATCH 'Author:<author>* <title>*'
It works when <author>
and <title>
do not contain spaces (i.e. a single word), but when I try, for example, for author: "mark tw", it will not match any rows because there are 2 words.
So, is it possible to use a prefix for a phrase query composed of multiple words?
Upvotes: 1
Views: 1102
Reputation: 31
Can't work. A match on a specific column can't contain spaces at this moment. Something like match column1: "abc 123" just matches any column with "abc 123" in it because the query parser does not see "abc 123" as an argument to column1, but as a different filter (it sees it like column1:anything "abc 123"). Seems like an oversight to me. column1:"abc 123" (with no space) does not return anything. column1:abc 123 does return rows where column1 matches abc and one of the other columns contains 123.
Upvotes: 1
Reputation: 180010
A search with a column specification should be done against the entire table, and a phrase search is not parsed correctly in this situation if there is no space after the colon:
... WHERE books MATCH 'Author: "mark tw*" title*'
Upvotes: 1