我有一个应用程序,它使用思考狮身人面像进行搜索,我可以让构面正确显示在视图中,但是链接没有返回具有给定选项的结果列表。这是我为模型控制器和视图提供的代码:
控制器:
@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 =>" 散列的值部分包含构面选项,我可以获得正确的结果。但是我不确定如何配置链接,以便它执行另一个搜索,并将该值插入到控制器代码中。任何帮助,将不胜感激。