Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiword Synonym Search broken #29

Open
Schabernack opened this issue Mar 24, 2015 · 0 comments
Open

Multiword Synonym Search broken #29

Schabernack opened this issue Mar 24, 2015 · 0 comments

Comments

@Schabernack
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant