Closed lucasgonze closed 11 years ago
http://www.postgresql.org/docs/8.3/static/textsearch-controls.html
Without quotes, to_tsquery will generate a syntax error for tokens that are not separated by an AND or OR operator.
plainto_tsquery([ config regconfig, ] querytext text) returns tsquery
plainto_tsquery transforms unformatted text querytext to tsquery. The text is parsed and normalized much as for to_tsvector, then the & (AND) Boolean operator is inserted between surviving words.
Example:
SELECT plainto_tsquery('english', 'The Fat Rats');
plainto_tsquery
-----------------
'fat' & 'rat'
Note that plainto_tsquery cannot recognize either Boolean operators or weight labels in its input
See https://github.com/brianc/node-postgres/issues/212
I'm using the pg fulltext search feature. When I use a parameter value with a space in it, it is expanded incorrectly and a SQL error is thrown.
If params.needle has no spaces in it, it executes correctly. For example I can search on "a_b". But if it has a space, I get:
I suspect that that's happening is that the argument is being expanded into multiple arguments, so that after substitution to_tsquery looks like to_tsquery('english','a','b').