Hi,
I've got a strange problem when using Facets. It reports one facet
result having, in this example, 39 items but when I use @facets.for it
returns an empty array. There are about 20 other facets reported in
this category and they all work as expected with @facets.for, its only
the facet that has the largest number reported that does not return
anything. I can see the items that fit into the category in the main
search results list so the data is there.
Here is the code I use:
@facets = ThinkingSphinx.facets params[:search], :all_facets =>
true, :class_facet => false, :page => params[:page], :order
=> :created_at, :sort_mode
=> :desc, :with=>{:search_access_tag=>@search_access_tags << 0}
And the html:
<% @facets.each do |facet, facet_options| %>
<h3><%= facet.to_s[0..facet.to_s.length-6].humanize.titleize.pluralize
%></h3>
<ul>
<% facet_options.each do |option, count| %>
<% next if option==nil or option=="" %>
<li><%= link_to "#{option} (#{count})", :params => {facet =>
option, :search=>params[:search], :page => 1} %></li>
<% end %>
</ul>
<% end %>
And then when you click on one of the links it takes you to
if params[:project_category_name]
@search_results =
@facets.for(:project_category_name=>params[:project_category_name].to_s)
end
What is the best approach in debugging this inconsistency in what is
reported from the main facets call and the @facets.for returns? Are
there any known issues when using :all_facets?
Warm regards,
Robert
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/thinking-sphinx?hl=en.