Hi,
I've been banging my head against the nearest wall trying to find the
best way to create links from the results I get back from searching
across all my models. Essentially I want it so that there is a single
search controller that will search all my existing models and return
the results of the search, with links to the page in question.
So is facet's the way to go, or should I be using the normal Search?
Below is how I perform the facet search, and it works fine, my trouble
is handling the output it gives me.
def search
@query = params[:query]
@facets = ThinkingSphinx.facets @query, :all_facets => true,
:star => true
respond_to do |format|
format.html
format.xml { render :xml => @facets }
end
end
<div class="search">
<% @facets.each do |facet, facet_options| %>
<% unless facet_options.blank? %>
<h5><%= facet %></h5>
<ul>
<% facet_options.each do |option, count| %>
<li><%= link_to "#{option} (#{count})",
:params => {facet => option, :page => 1} %></li>
<% end %>
</ul>
<% end %>
<% end %>
</div>
Basically I don't want the situation where I have to check the
instance of the option to decide what path from routes to give it, I'd
really prefer it if there was a general method that'll find this for
me.
Should I really be using facets here, or normal search?
And as a side note, is there anyway to get ALL results from search?
Not just the first 10?
Thank you for your help.
plcs
--
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.