Thanx Pat for the explanation. I added :match_mode => :extended, and
it's working now.

Cheers

On May 24, 12:31 am, Pat Allan <[email protected]> wrote:
> The '@name value' syntax is actually for fields, not attributes - you won't 
> see attribute filters in the logs. Another thing you don't see in the logs is 
> the match mode, which needs to be set to :extended when searching on specific 
> fields. When you use :conditions, this is done automatically, but a normal 
> search of '@gender male' will not do that unless you add :match_mode => 
> :extended.
>
> Also, :sortable attributes are *only* useful for sorting, not filtering.
>
> Hope this clears things up.
>
> Cheers
>
> --
> Pat
>
> On 23/05/2010, at 11:33 PM, Al-Faisal El-Dajani wrote:
>
>
>
> > Hello,
>
> > My user model contains a 'gender' field, which is populated with
> > either 'male' or 'female'. My define_index block includes the line:
> > indexes gender.
>
> > When I try searching from the web interface, I add :conditions =>
> > {:gender => params[:gender]} to filter by gender. However, I keep
> > getting an empty result set. I checked the logs and found that sphinx
> > is actually searching for '@gender male'.
>
> > So, I opened up a console, and I tried searching using the :conditions
> > => {:gender => 'male'} and another search using '@gender male'. Sure
> > enough, the first one returns results as intended, and the latter
> > returns an empty array.
>
> > If I understand correctly, using the @ syntax in search is for
> > attributes, not fields. So I tried to add :sortable => true to my
> > index gender line. (sortable => true adds another attribute to sort
> > by, right?). However, this didn't change anything.
>
> > My questions:
> > 1) When I try to search using :conditions => { ... }, why is it
> > getting converted to '@gender male'?
> > 2) Why is it failing to find any results?
>
> > Using rails 2.3.5, ruby 1.8.7, sphinx 0.9.9, and thinking sphinx
> > 1.3.16
>
> > 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 
> > 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 
> 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.

Reply via email to