Hi Stephen Conditions can (and should) be strings - because they reference fields. Filters (managed by the :with option, as you've used already), must be integers, timestamps, booleans or floats.
So, filtering on discussable_id is easy enough, because it's an integer, and you can use it in a filter. You can combine this with a search upon a field for discussable_type, although field searches make use of Sphinx's smarts - which is good in some situations, but can get in the way in others... So, you may want to add a CRC'd attribute for discussable_type instead: http://freelancing-god.github.com/ts/en/common_issues.html#string_filters Does this fit what you're after? -- Pat On 18/02/2010, at 5:58 AM, Stephen wrote: > I've created a message board system thats completely polymorphic, it > can be attached to pretty much any other object in my program and it > just works. > > So I want to be able to search for all topics, within a particular > board. When it was tied to just a band_id this was easy as > > has band_id > > :with => { :band_id => 5 } > > Now, topics have a discussable_id and a discussable_type. It seems > that conditions/attributes must be an integer of some kind - so how > can I filter based on that relationship? > > Thanks.. > > > > > > > > > > > > > -- > 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.
