Not sure about facets not being sortable but I think you are right.
One way to work around is is to just do it manually. There are about 200
countries in the world which results in a maximum of 200 facets – which is
still a reasonable amount for manual sorting, even more so if you can somehow
cache the result.
facets = Athlete.facets[:country_name].sort_by { |country_name, count| -count
}[0,5] # note the - for descending sorting
Hope that helps at least a little :-)
- C.
On Mar 8, 2011, at 12:56 AM, gerberdata wrote:
> Everyone,
>
> So I gather right now from reading the posts that there is no way to
> order the facet results. Has anyone found a workaround for this?
> Basically I have a line in my index definition.
>
> indexes hometown.country_name, :as=>:country_name, :sortable=>
> true,:facet=>true
>
> I need to be able to order these results and limit the results to
> about 5 records.
>
> like Athlete.facets [:country_name]
>
> then order result.
>
> --
> 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.
>
--
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.