What’s the output of @results.total_entries ? On 26 Mar 2014, at 9:53 pm, Георгий Погосян <[email protected]> wrote:
> No, the same result > > среда, 26 марта 2014 г., 14:30:50 UTC+4 пользователь Pat Allan написал: > What if you try getting the facets directly, instead of via the search: > > @facets = ThinkingSphinx.facets params[:query] > > I think the per_page and page options may be getting in the way of the full > set of results. > > On 26 Mar 2014, at 9:19 pm, Георгий Погосян <[email protected]> wrote: > >> Hi, Pat! >> >> I can't understand how to get the model_names on which there is proper >> indexing and search on the search results page. >> The idea is to show the total entries for each model. >> For example: Total (40) >> Pages (10) >> Products (30) >> >> If I understand correctly now it is realized through the facet. I did as in >> the example, but the result is not what I need. >> >> Here's my SearchController: >> @results = ThinkingSphinx.search(params[:query], :page => params[:page], >> :order => 'created_at DESC', :per_page => 10) >> @facets = @results.facets >> >> View: >> <ul class="detailed"> >> <%= @results.total_entries %> >> <% @facets.each do |facet, facet_options| %> >> <% facet %> >> <ul> >> <% facet_options.each do |option, count| %> >> <li><%= link_to "#{option} (#{count})", :params => >> {facet => option, :page => 1} %></li> >> <% end %> >> </ul> >> <% end %> >> </ul> >> <ul class="results"> >> <% @results.each do |result| %> >> <li><%= render :partial => partial_for_search_result(result), >> :locals => {:result => result} %></li> >> <% end %> >> </ul> >> >> And the result is: >> sphinx_internal_class >> Catalog (3) >> Page (3) >> >> class >> Catalog (3) >> Page (3) >> >> My TS version 3.1.0 >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Thinking Sphinx" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/thinking-sphinx. >> For more options, visit https://groups.google.com/d/optout. > > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/thinking-sphinx. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/thinking-sphinx. For more options, visit https://groups.google.com/d/optout.
