pgsearch for whole words with multisearchable
pgsearch for whole words with multisearchable
如果这是一个重复的问题,请原谅。我是初级 rails 开发人员,最近在我的应用程序上安装了 pgsearch。
我安装了 pg_trgm contrib 包(:trigram 和 :dmetaphone)。
当我搜索 "how to interview" 时,我收到的结果如 "discriminatory" 突出显示 "to",或“however” "how" 突出显示。
这是我的初始化程序:
PgSearch.multisearch_options = {
:using => {
:trigram => {
:threshold => 0.5
},
:dmetaphone => {
:any_word => true,
:sort_only => true
},
:tsearch => {
:prefix => true,
:any_word => true,
:dictionary => "english",
:normalization => 2
}
}
}
如何修改 pg_search 以搜索整个单词?
*忘了说,我在我的模型中使用 multisearchable :against => [:title, :body]。
根据我在 github 仓库中的阅读,您需要删除行 :prefix => true,
但总的来说,也许可以删除所有您不理解的选项,然后将它们逐一叠加,看看它们如何影响结果。
如果这是一个重复的问题,请原谅。我是初级 rails 开发人员,最近在我的应用程序上安装了 pgsearch。
我安装了 pg_trgm contrib 包(:trigram 和 :dmetaphone)。
当我搜索 "how to interview" 时,我收到的结果如 "discriminatory" 突出显示 "to",或“however” "how" 突出显示。
这是我的初始化程序:
PgSearch.multisearch_options = {
:using => {
:trigram => {
:threshold => 0.5
},
:dmetaphone => {
:any_word => true,
:sort_only => true
},
:tsearch => {
:prefix => true,
:any_word => true,
:dictionary => "english",
:normalization => 2
}
}
}
如何修改 pg_search 以搜索整个单词?
*忘了说,我在我的模型中使用 multisearchable :against => [:title, :body]。
根据我在 github 仓库中的阅读,您需要删除行 :prefix => true,
但总的来说,也许可以删除所有您不理解的选项,然后将它们逐一叠加,看看它们如何影响结果。