【问题标题】:Postgres ts_rank_cd: No function matches the given name and argument typePostgres ts_rank_cd:没有函数匹配给定的名称和参数类型
【发布时间】:2013-08-20 21:55:33
【问题描述】:

我正在使用 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 文档中的基本示例进行操作。

【问题讨论】:

    标签: postgresql full-text-search


    【解决方案1】:

    试试这个查询:

    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
    

    【讨论】:

    • 这给了我营养=> select title, ts_rank_cd(to_tsvector(title), query) as rank from food.usda, to_tsquery('egg') query where query @@ title order by rank desc;错误:运算符不存在:tsquery @@ 字符变化第 1 行:...om food.usda, to_tsquery('egg') query where query @@ title o... ^ 提示:没有运算符匹配给定的名称和参数类型。您可能需要添加显式类型转换。
    猜你喜欢
    • 2018-02-25
    • 2014-09-05
    • 1970-01-01
    • 2021-02-13
    • 2016-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-20
    相关资源
    最近更新 更多