I hesitated to do that because it felt "too easy" and I wasn't sure if
the double association wouldn't break something :-)

But it works seamlessly. Thanks!

On 5 Aug., 14:20, Pat Allan <[email protected]> wrote:
> Hi Christian
>
> Try defining an association with that condition built-in (guessing the  
> exact syntax):
>    has_many :real_locations, :class_name => "Location", :conditions =>  
> "artificial = 0"
>
> Then use that new association for your indexes:
>    indexes real_locations.name, :as => :location_name, :facet => true
>
> If this doesn't work out, let me know.
>
> --
> Pat
>
> On 05/08/2009, at 1:06 PM, Christian Aust wrote:
>
>
>
>
>
> > Hi all,
>
> > My class Project has_many locations. TS happily creates a sphinx
> > configuration to index locations.name which works like a charm.
>
> > But: I don't need all of my instances of Location in the index and as
> > facets. In fact, I'd need a WHERE clause for this association.
> > Something like
>
> > indexes locations
> > (:name), :as=>:location_name, :facet=>true, :conditions=>
> > { :artificial=>false }
>
> > would do the job and index only those location instances whose
> > database field "artificial" is false. Is this supported already? Can I
> > do this with TS, at all? Regards,
>
> > Christian
--~--~---------~--~----~------------~-------~--~----~
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