mercredi 4 mars 2015

Automatic OR queries using SQLite FTS4

I have a SQLite FTS4 database, and I would like to be able to perform OR queries on it from user-input, e.g. if the user enters "hello there" I would like to do



SELECT * FROM fts_table WHERE text MATCHES 'hello OR there'.


However, if I pass simply pass in the user-string I get an implicit AND query instead. I could of course tokenize the string myself, and insert ORs, but then I'm using my own tokenizer which could differ from the tokenizer being used internally by SQLite's FTS.


Is there some way to either access the SQLite tokenizer from my C wrapper, or else to construct a SQL query that does this, along the lines of:



SELECT * FROM fts_table WHERE text MATCHES interpolate('hello there', ' OR ')


Thanks any pointers would be appreciated.


Aucun commentaire:

Enregistrer un commentaire