狮身人面像范围什么也不返回
我正在尝试创建一个 sphinx 将索引的简单范围(Ruby on Rails)。正常作用域返回应有的结果,sphinx 作用域不返回结果。
define_index do
# fields
indexes :name
indexes author
indexes description
indexes list_of_tags
indexes approved
# attributes
has created_at, updated_at, downloads
# delta indexing
set_property :delta => true
# weighting fields
set_property :field_weights => {
:name => 10,
list_of_tags => 6,
author => 5,
description => 4,
}
end
正常范围:
scope :approved, where(:approved => true)
sphinx范围:
sphinx_scope(:approval_scope) {
{:conditions => {:approved => "true"}}
}
批准是一个布尔字段,但是,由于我将其索引为字段,所以我相信它的值被视为字符串。无论如何,让 sphinx 范围的值为“true”或 true 没有什么区别 - 与 Theme.approval 不同,Theme.approval_score 仍然返回 0 个结果。我希望我错过了一些简单的事情..
I'm trying to create a simple scope that sphinx will index (Ruby on Rails). The normal scope returns what it should, the sphinx scope returns no results.
define_index do
# fields
indexes :name
indexes author
indexes description
indexes list_of_tags
indexes approved
# attributes
has created_at, updated_at, downloads
# delta indexing
set_property :delta => true
# weighting fields
set_property :field_weights => {
:name => 10,
list_of_tags => 6,
author => 5,
description => 4,
}
end
normal scope:
scope :approved, where(:approved => true)
sphinx scope:
sphinx_scope(:approval_scope) {
{:conditions => {:approved => "true"}}
}
Approved is a boolean field, however, since I'm indexing it as a field, I believe its value is treated as a String. Regardless, letting the value of the sphinx scope be "true" or true makes no difference - Theme.approval_score still returns 0 results unlike Theme.approval. I hope I'm missing something simple..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
进行批准
然后
make the approved with has
then