Model.search_for_ids :conditions => {:name => '@
(name,note_description) *blah*'},
:match_mode => :extended2,
:per_page => 100, :max_matches => 100,
:with => {:note_person_id => 1234, :note_created_at =>
1.week.ago..Time.now},
:group_by => 'id',
:group_function => :attr,
:group_clause => '@relevance desc'The AND logic between filters works unless i try to filter by date range on an association. In the case above the results will all contain 'blah' in them, will all have 'note' with person_id = 1234 AND will have a 'note' with create_at inside a range, bot NOT necessarily with id 1234. Speaking sql language: I expect the simple ... LEFT JOIN notes WHERE notes.person_id = 1234 AND notes.created_at > week_ago AND notes.created_at < now I get ... LEFT JOIN notes a LEFT JOIN notes b WHERE a.person_id = 1234 AND b.created_at > week_ago AND b.created_at < now I very much hope you get the idea. This is the best example i can think of. On Nov 25, 10:28 am, Pat Allan <[email protected]> wrote: > On 25/11/2009, at 9:04 AM, Phantom wrote: > > > > > > > Here it goes. > > > index: > > > ... > > indexes name > > indexes note.description, :as => :note_description > > > has note.created_at, :as => :note_created_at > > has note.author_id, :as => :note_author_id > > ... > > > 1) > > Is there no other way to exclude an indexed field from search, besides > > switching to :extended2 mode, and prepending a "@(fields,to,search)" > > to the search string? > > Unfortunately, the @(all,fields,but,one) option is the only way I know > of to exclude a specific field from your searching. > > > btw this method does not work with the ":star => true", because that > > prepended "@(fields,to,search)" also gets affected. But that is not a > > problem, and in no way a feature request ;) > > > 2) > > When doing a search like: > > > Model.search "blah blah", :with => { :note_author_id => > > [10], :note_created_at => some_range } > > > I get records with :note_author_id = 10 OR :note_created_at within > > certain range. Is there no way to force AND logic between filter > > hashes? I somehow thought that AND logic was the default behaviour. > > It should definitely be using AND - there's no way for multiple > filters to be done with OR logic. Can you provide some examples of the > data you're using in the filters? > > Cheers > > -- > Pat -- 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.
