函数ts_rank_cd(text,tsquery)不存在 [英] function ts_rank_cd(text, tsquery) does not exist

查看:1107
本文介绍了函数ts_rank_cd(text,tsquery)不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用postgres支持的全文搜索,我安装了 acts_as_tsearch 插件,它能够成功运行,但是当我稍后尝试时,我发现一个错误


$ b


runtimeError:错误C42883函数ts_rank_cd(text,tsquery)
不存在HNo函数与给定的名称和参数类型匹配。您
可能需要添加显式类型



解决方案

参数到tsvector中。



因此,让我们假设您搜索名为 foo.text 的列。你会想改变它:

  SELECT ts_rank_cd(foo.text,plainto_tsquery('my search terms'))FROM foo ; b 




SELECT ts_rank_cd(to_tsvector(foo.text),plainto_tsquery('my search terms'))FROM foo;

或类似的东西。



如果你'在其他地方使用 @@ 运算符时,通常可以重新使用该运算符运行的表达式。



您可以在 to_tsvector 的更多文档-PARSING-DOCUMENTSrel =nofollow> http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-PARSING-DOCUMENTS


I'm using full text search supported by postgres, I installed acts_as_tsearch plugin and it works successfully, but when I tried it later I found an error

runtimeError: ERROR C42883 Mfunction ts_rank_cd(text, tsquery) does not exist HNo function matches the given name and argument types. You might need to add explicit type

解决方案

You need to cast your first parameter into a tsvector.

So let's assume you're searching against a column named foo.text. You will want to change from this:

SELECT ts_rank_cd(foo.text, plainto_tsquery('my search terms')) FROM foo;

to this:

SELECT ts_rank_cd(to_tsvector(foo.text), plainto_tsquery('my search terms')) FROM foo;

or something similar.

If you're using the @@ operator elsewhere, you can generally re-use the expressions that operator is operating on.

You can find more documentation on to_tsvector at http://www.postgresql.org/docs/current/static/textsearch-controls.html#TEXTSEARCH-PARSING-DOCUMENTS

这篇关于函数ts_rank_cd(text,tsquery)不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆