You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure if this can actually be considered a bug, here it goes anyway:
If you use pgsql thesaurus to define multi-word synonyms, they will not get picked up by searchable. If you search for multiple words, searchable will 'and' them together. This means that every word is lexed separately, synonyms are not picked up:
=> select * from test where search_vector @@ to_tsquery('pg', 'synonym & test');
(No rows)
=> select to_tsquery('synonym & test');
to_tsquery
--------------------
'synonym' & 'test'
(1 row)
what should be done instead is to use plainto_tsquery or escape the string properly:
=> select to_tsquery('''synonym test''');
to_tsquery
------------
'result synonym word'
(1 row)
=> select * from test where search_vector @@ to_tsquery('pg', '''synonym test''');
-[ RECORD 1 ]---+----------
Thats obviously not something that should be done for every search, but a fallback option could be useful for this usecase.
The text was updated successfully, but these errors were encountered:
I am not sure if this can actually be considered a bug, here it goes anyway:
If you use pgsql thesaurus to define multi-word synonyms, they will not get picked up by searchable. If you search for multiple words, searchable will 'and' them together. This means that every word is lexed separately, synonyms are not picked up:
what should be done instead is to use plainto_tsquery or escape the string properly:
Thats obviously not something that should be done for every search, but a fallback option could be useful for this usecase.
The text was updated successfully, but these errors were encountered: