私は、スフィンクスが索引付けする単純なスコープ(Ruby on Rails)を作成しようとしています。通常のスコープは必要なものを返しますが、スフィンクスのスコープは結果を返しません。
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,
}
終わり
通常の範囲:
scope :approved, where(:approved => true)
スフィンクススコープ:
sphinx_scope(:approval_scope) {
{:conditions => {:approved => "true"}}
}
しかし、私はフィールドとしてインデックスを作成しているので、私はその値が文字列として扱われると信じています。それにかかわらず、スフィンクススコープの値を「true」またはtrueにすることで違いはありません。Theme.approval_scoreはTheme.approvalとは異なり0の結果を返します。私は単純なものが欠けていると思う。