Hi Pat, really thanks for your help! Both methods worked like a charm here. I'll be using the latter approach in my app.
Again, thanks! On Aug 3, 11:47 am, Pat Allan <[email protected]> wrote: > Hi Klaus > > There are solutions for what you want to do, but it depends on whether > you're exluding a certain attribute value, or a field value. > > For attributes: > Model.search 'pancakes', :without => {:category_id => 5} > > For fields: > Model.search 'pancakes', :conditions => {:category => '! > 5'}, :match_mode => :extended2 > # this is the same as 'pancakes @category_id !5' > > Hope this helps. > > Cheers > > -- > Pat > > On 03/08/2009, at 2:48 PM, Klaus Paiva wrote: > > > > > Hello, > > I'm having a simple (I think) problem: I want to perform a search with > > (or conditions) but using a NOT clause. > > > For example, I'd like to search for 'pancakes' in any category but not > > inside the category 5 (just an id, for example). > > > I've been trying to something like this: > > > MyModel.search 'pancakes', :with => { :category_id => 'NOT 5' } # > > or :conditions > > > But it doesn't work... (without the NOT there it will correctly search > > only inside the given category). I did some tests with ! or - too but, > > without any success. > > > Thinking a bit more... I found a solution using the extended2 > > match_mode and a query like this: "pancakes @category_id !5". It works > > but I think it's a little ugly. :) > > > Well, my question here is simple: is there any way to perform a NOT > > operation with conditions or with hashes? > > > Thanks for this incredible project! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
