Sign in
Log inSign up
Leandro Proença

9 likes

·

14.9K reads

3 comments

jacobbill
jacobbill
Feb 3, 2022

seems like ts_rank(to_tsvector(courses.title), query) can give 1e-20 which will not be cast to null. This was causing poor ranking as 1e-20 results are brought to the top

·
Simon Hirscher
Simon Hirscher
Aug 11, 2022

Thank you for the simple and easy to understand post. Is the query still performant with the use of the similarity function?

·
Wiley McKay Conte
Wiley McKay Conte
Mar 13, 2023

One thing to note is you'll likely need/want to concatenate the columns you want to search across like this:

to_tsvector(courses.title || ' ' || courses.description)

·