Given that ripen is an attribute, you'll want to filter on it:
ThinkingSphinx.search :with => {:ripen => 1}
To ensure Vegetables and Grain are returned as well, you should add a manual
attribute to those index definitions:
has '1', :as => :ripen, :type => :integer
Run rake ts:rebuild, and you should be good to go.
Cheers
--
Pat
On 19/01/2011, at 4:55 PM, Z@M wrote:
> Suppose I have 3 models Fruit, Vegitable and Grain,
> Class Fruit
> define_index do
> indexes name, :as => :name
> has ripen, :as => :ripen
> end
> end
>
> Class Vegitables
> define_index do
> indexes name, :as => :name
> end
> end
>
> Class Grain
> define_index do
> indexes name, :as => :name
> end
> end
>
> ThinkingSphinx.search :conditions=>{:ripen=>1}
> This is giving me only the fruits . what i need is all the fruits
> which is ripen and all vegitables and grains.
>
> i tried this so that there is a common index in all classes which
> makes conditions easy but it throws errors.
> Class Vegitables
> define_index do
> indexes name, :as => :name
> indexes 1, :as => ripen
> end
> end
>
>
>
> --
> 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.