Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres ts_rank_cd: No function matches the given name and argument type

I am using Postgres 9.1 and trying to get fulltext ranking working.

I am following

http://www.postgresql.org/docs/9.1/static/textsearch-controls.html#TEXTSEARCH-RANKING

nutrition=> SELECT title, ts_rank_cd(title, query) AS rank FROM food.usda, to_tsquery('egg') query WHERE query @@ title order by rank desc;
ERROR:  function ts_rank_cd(character varying, tsquery) does not exist
LINE 1: SELECT title, ts_rank_cd(title, query) AS rank FROM food.usd...
                  ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

There is a related posting

function ts_rank_cd(text, tsquery) does not exist

but why does my query not work? Is this a documentation error? I am just following the basic example from the 9.1 docs.


1 Answers

try this query:

select title, ts_rank_cd(to_tsvector(title), query) as rank
from food.usda, to_tsquery('egg') query
where to_tsvector(title) @@ query
order by rank desc
like image 66
Roman Pekar Avatar answered Oct 31 '25 05:10

Roman Pekar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!