Hi Tom

Since you've got store ids there as a multi-value attribute, this is easy enough:

  Song.seach :with => {:stores => special_store_id}

This will return all songs that have the specific store as one of their stores.

You can't neatly do this with fields though, because that brings into play Sphinx's query intelligence (fuzzy), and you're doing something precise.

Cheers

--
Pat

On 02/09/2010, at 11:50 PM, Tom <[email protected]> wrote:

If I have a model:
class Song < ActiveRecord::Base
 has_and_belongs_to_many :stores

 define_index do
   indexes :name

   has stores(:id), :as => :stores
 end
end

Then I can construct a search with a SQL IN() like condition using
something like :with => { :name => ['x','y','z] }

Is there any way of making a condition that would use IN the other way
round ie returning songs that have somestore as one of their stores?

Very new to Sphinx, so apologies if this is a) very obvious, or b)
obviously impossible.

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.

Reply via email to