Postgres ts_rank_cd: No function matches the given name and argument type
full-text-search, postgresql
Solution
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
Problem
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.