検索に思考スフィンクスを使用するアプリケーションがあり、ファセットをビューに正しく表示できますが、リンクが指定されたオプションの結果のリストを返していません。モデルコントローラーとビュー用に持っているコードは次のとおりです。
コントローラー:
@facets = Load.facets(
(params[:trucks]),
:page => (params[:page] || 1),
:per_page => 25,
:geo => degrees_to_radians(@location),
:with => { "@geodist" => 0.0..miles_to_meters(params[:radius].to_i) },
:sort_mode => :expr,
:order => sort_by_select(params[:sort])
)
@results = @facets.for
モデル:
define_index do
indexes commodity
indexes truck_type
has latitude, longitude
has distance, :facet => true
has weight, :facet => true
has current_asking_price, :facet => true
has created_at, :facet => true
where sanitize_sql(["active", true])
set_property :delta => :delayed
end
景色:
<% @facets.each do |facet, facet_options| %>
<h5><%= facet %></h5>
<ul>
<% facet_options.each do |option, count| %>
<li><%= link_to "#{option} (#{count})", :params => {facet => option, :page => 1}</li>
<% end %>
</ul>
<% end %>
「:with =>」ハッシュの値の部分にファセットオプションを含めると、正しい結果を得ることができます。ただし、リンクを構成して別の検索を実行し、その値をコントローラーコードに挿入する方法がわかりません。どんな助けでもいただければ幸いです。