I am not sure if this is really critical. After all, a slightly modified query will work.
And while I sketched a possible fix in previous comment, I am not sure if we should implement it or if we should simply keep the current behaviour: My impression about ftq() os that it tries to do too much DWIM anyway, and I'd prefer to make the function more simple and thus its behaviour better predictable.
A bad DWIM example: A '-' preceded by a space and preceding a word is converted into a '!', i.e., the term "-foo" is treated as "find texts that do not contain the word 'foo'". That's fine for words, but breaks utterly for numbers. The TS data for a simple calculation:
I am not sure if this is really critical. After all, a slightly modified query will work.
And while I sketched a possible fix in previous comment, I am not sure if we should implement it or if we should simply keep the current behaviour: My impression about ftq() os that it tries to do too much DWIM anyway, and I'd prefer to make the function more simple and thus its behaviour better predictable.
A bad DWIM example: A '-' preceded by a space and preceding a word is converted into a '!', i.e., the term "-foo" is treated as "find texts that do not contain the word 'foo'". That's fine for words, but breaks utterly for numbers. The TS data for a simple calculation:
select to_tsvector( '123-456' );
to_tsvector
------------------
'-456':2 '123':1
"123-456" used as a search term:
select ftq('123-456');
ftq
----------------
'123' & '-456'
so there is no match because '456' != '-456':
select to_tsvector('123 - 456') @@ ftq('123-456');
?column?
----------
f