3
我有一個應用程序,它使用思維獅身人面像進行搜索,我可以在視圖中正確顯示構面,但鏈接不會返回給定選項的結果列表。下面是我對模型控制器和視圖代碼:深入思考獅身人面像刻面
控制器:
@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 =>」散列的值部分中包含構面選項,則可以獲得正確的結果。不過,我不確定如何配置鏈接,以便執行其他搜索,並將該值插入到控制器代碼中。任何幫助,將不勝感激。