Thanks for the praise - I just wish I had some more useful answers for  
you. Still, read below for my points.

On 12/06/2009, at 12:22 PM, Sticorp wrote:

> 1. Thinking faceting does not seems to work with habtm relationships
> (it kinda works, but if lets say I have a products associated with
> category1 and category2, the facets returns like that =>
> category1category2 (23), and NOT like => category1 (34) category
> (23)... Am I doing something wrong? Please Pat, help me.

You're not doing anything wrong with regards to facets, as far as I  
can see. Facet support hasn't yet covered some common usage areas -  
HABTM joins being one of those. If you could create a ticket on GitHub  
for this, that'd be great. I'll try to add some failing tests and then  
get it working when I have a moment. No promises to when that'll be  
though.

> 2. Is there a way of limiting the number of facets returned? Let me
> explain. Suppose that I search for "xxxxx" and I'm faceting on Brands
> (Product belongs_to Brand). It will return, let's say 21 different
> brands. I want to return ONLY the TOP 5 brands (with the most count),
> ordered by count DESC. Is this possible?

It's not possible at the moment. It would be nice, though... maybe  
using an option like :facet_limit? Again, create a ticket, this one  
doesn't sound too hard to implement.

> 3. How can I sort the facets (by name or by count)? For now, it seems
> to return in the exact order found in the database.

Facet results are returned as hashes - which can't be sorted. Not that  
I don't see the value in what you're asking, it's just that the  
implementation becomes a bit trickier because of how hashes (don't)  
work.

> Do you have any suggestions for my code?

It all looks fine to me. The repetitiveness of the #search and #facets  
calls taking the same arguments is a shame, but there's nothing (yet)  
in Thinking Sphinx that makes that easier.

Cheers

-- 
Pat

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to