Postgres ts_rank_cd:没有函数匹配给定的名称和参数类型

时间:2013-08-19 07:02:18

标签: postgresql full-text-search

我正在使用Postgres 9.1并试图让全文排名工作。

我正在关注

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.

有相关的帖子

function ts_rank_cd(text, tsquery) does not exist

但为什么我的查询不起作用?这是文档错误吗?我只是按照9.1文档中的基本示例进行操作。

1 个答案:

答案 0 :(得分:2)

尝试此查询:

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