This is tricky - you cannot search in Sphinx with *just* a negative term (i.e.: 
anything where a field is *not* inactive). It requires at least one word to 
positively match on - so this is fine:
  Model.search "foo -bar", :match_mode => :extended

It matches results with the word foo but not the word bar. But Sphinx won't 
like this:
  Model.search "-bar", :match_mode => :extended

So, it may be better, given a status column has a known set of values, to 
search on all of those values instead:
  Model.search :conditions => {:status => "(active | pending)"}

-- 
Pat

On 06/02/2012, at 9:37 PM, mohitnegi wrote:

> Hi,
> I was going through the documentation there i found that if i wish to exclude 
> any particular attribute value then i can pass it as
> 
> Model.search :without => {:attribute=>value}
> 
> But lets say if i wish do to exclude any field value then is there a way for 
> that.
> 
> let say my index has
> 
> define_index 
>  indexes :status
> end
> 
> now if i want records where status value is anything other than "inactive", 
> How to get that
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/thinking-sphinx/-/PcXMdEE1LL4J.
> 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