On 7/11/17, Jens Alfke <j...@mooseyard.com> wrote:
> I’m using FTS4, and queries involving a single MATCH expression work fine.
> But if there are two MATCH expressions, the queries generated by my code
> fail to compile, with an error "unable to use function MATCH in the
> requested context”. Can someone explain what’s going wrong?
>

While the query planner is processing the WHERE clause, it passes
various terms down to FTS4 and asks "can you deal with this?"
Normally, FTS4 will answer "yes" to a MATCH operator and take full
responsibility for it, so that the SQLite core does not do any more
with it.  But in the specific query you have, FTS4 is unable to handle
the MATCH function and so it answers "no".  Or, maybe due to the OR
clause, the query planner is not able to factor out the MATCH function
and so it never even asks.  I'm not sure which, but for whatever
reason, FTS4 did not take responsibility for handling the MATCH
operator.

That means that the MATCH operator remained as the responsibility of
the SQLite core.  But the core has no idea what the MATCH operator is
suppose to do.  So it implements the MATCH operator using the
sqlite3InvalidFunction() functions
(https://www.sqlite.org/src/artifact/899d8f02?ln=748-768) and that
function throws an error, by design.


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to