views:

53

answers:

2

I'm using Python and SQLAlchemy to query a SQLite FTS3 (full-text) store and I would like to prevent my users from using the - as an operator. How should I escape the - so users can search for a term containing the - (enabled by changing the default tokenizer) instead of it signifying "does not contain the term following the -"?

A: 

From this documentation it seems that it is not really possible. Try to replace your - with whitespace before searching…

Benoit
A: 

From elsewhere on the internet it seems it may be possible to surround each search term with double quotes "some-term". Since we do not need the subtraction operation, my solution was to replace hyphens - with underscores _ when populating the search index and when performing searches.

joeforker