使用 ultrasphinx 按记录 ID 搜索
我正在尝试使用 Rails 2.3.8 上的 ultrasphinx 按记录 id 进行搜索
在我的模型中,我尝试了以下操作:
class Offer < ActiveRecord::Base
is_indexed :fields => [{:field => 'id', :as => 'offer_id'}]
end
并且
class Offer < ActiveRecord::Base
is_indexed :fields => ['id']
end
我使用
Ultrasphinx::Search.new(:query => "1691")
It 进行搜索不会返回任何结果,而搜索其他索引字段则会返回任何结果。
I'm trying to search by record id with ultrasphinx on Rails 2.3.8
In my model i tried the following:
class Offer < ActiveRecord::Base
is_indexed :fields => [{:field => 'id', :as => 'offer_id'}]
end
and
class Offer < ActiveRecord::Base
is_indexed :fields => ['id']
end
And I search with
Ultrasphinx::Search.new(:query => "1691")
It doesn't return any results, while searching for other indexed fields does.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哇。过去的爆炸。
虽然我在开始使用 UltraSphinx 后转向 ThinkingSphinx,但您确定您不应该使用
它,也许现在尝试一下,然后弄清楚如何执行 AS。
Wow. a blast from the past.
Whilst I shifted to ThinkingSphinx after starting off with UltraSphinx, are you sure that you shouldn't be using
maybe try that for now and then figure out how to do the AS after.