AHA! That's perfect. I already do quite a bit of preprocessing before assigning the hash to :with. It shouldn't be hard to move all HABTM relationships into :with_all.
Thanks, Bob On Mar 12, 5:01 pm, Pat Allan <[email protected]> wrote: > Hi Bob > > There's no clean way of doing this, but you could make the query yourself > manually (ie: a normal search instead of @facets.for(:facet => x)). > > Model.search 'normal search', :with_all => {:activity_ids => [1, 2]} > > If the facet is built off a string/field, not integers, then the field name > gets a _facet suffix, and CRC'd: > > Model.search 'normal search', :with_all => {:activities_facet => > ['hiking'.to_crc32, 'swimming'.to_crc32]} > > Hope this helps. > > -- > Pat > > On 13/03/2010, at 11:55 AM, Bob B. wrote: > > > Hi, > > > I'm using facets with an HABTM relationship and it's been working > > well. The one problem I'm having is that when two or more facets > > underneath the HABTM relationship are selected, Sphinx will OR them > > instead of ANDing them. > > > So, say I'm searching on a trip by activities. I click on the > > "hiking" facet and get this: > > > hiking (10) > > swimming (4) > > boating (3) > > skiing (1) > > > where the number is the count of trips that have this activity along > > with hiking. If the user adds "swimming" as a facet (now hiking and > > swimming are both selected), I'd expect 3 trips to be returned, but > > instead it returns way more. It behaves this way because it's now > > grabbing all trips that have hiking OR swimming. Is there anyway to > > tell Sphinx (or Thinking Sphinx) that I'd like the HABTM relationship > > ANDed? > > > Thanks, > > Bob > > > -- > > 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 > > athttp://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.
