I am trying to use text search of postgresql, I have created a ts_vector column using existing two columns of the table and index that column using GIN index. Now when i am querying the i have noticed a weird behaviour, score of the query reducing when i am using operators like "&" or "|" in the to_tsquery function.
For 1 million records :-
- explain select title, body from xyz ff where search_vector @@ to_tsquery('english', 'apps'); --> score is around 300
- explain select title, body from xyz ff where search_vector @@ to_tsquery('english', 'apps & apps'); --> score is around 30
This behaviour i am not able to understand, the difference in bith the queries is using a operator, if i change it to "apps & tenant" then also score is around 30 but for single word search the score is high. Can someone please explain this behaviour and the reason behind it.
Thanks in advance.