gpt4 book ai didi

ruby-on-rails - 太阳黑子合取和析取不起作用

转载 作者:行者123 更新时间:2023-12-04 05:52:27 25 4
gpt4 key购买 nike

我收到此错误 NoMethodError: undefined method 'any' for #<Sunspot::DSL::Search:0x000000037a8070>

当我尝试按照文档进行操作时。 https://github.com/sunspot/sunspot#disjunctions-and-conjunctions

Post.search do
any do
fulltext "keyword1", :fields => :title
fulltext "keyword2", :fields => :body
end
end

我正在使用最新版本的 sunspot 2.1.1 .我正在使用 defaultOperator="OR"在我的模式 xml 中,我想要 AND 两个结果。如果我可以添加 AND 就可以了在两个查询之间使用 adjust_solr_params但我有更多条件,例如提升精确匹配和其他部分,检查特定文本字段。我想通过完全匹配来提升记录,它也应该给出 ngram 结果。所以目前 ngram 结果没有给出,因为 ANDing 与完全匹配的结果。任何建议我怎样才能做到这一点。

最佳答案

根据这个issue any|all 是在 2.1.1 版本后添加的。

您的版本的文档没有这些方法:https://github.com/sunspot/sunspot/tree/v2.1.1

所以,为了使用 any|all 你应该使用边缘版本或者等待下一个版本。

关于ruby-on-rails - 太阳黑子合取和析取不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27549779/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com