I have an application, that uses thinking sphinx for search and I can get facets to show up in the view correctly, but the links are not returning a list of the results with the given options. Here is the code that I have for the model controller and view:
The Controller:
@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
The Model:
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
The View:
<% @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 %>
I can get the correct results if I include the facet options in the value portion of the ":with =>" hash. However I am unsure how to configure the links so it performs another search, and inserts that value into the controller code. Any help would be appreciated.