I've made modifications to the code so that you may now supply a :type option to the search
method, as in IndexableRecord::search("foo bar", :type => :all). The :type can option can be either :any or :all with the default being :any. When set to :any, results containing any of the terms in the search phrase are returned. When set to :all results containing all of the terms in the search phrase are returned.
This is in version 0.2.1
The implementation for the :all option looks like this:
results = Context.find(:all, :include => :terms,
:conditions => ["term = ?", terms.shift])
terms.each do |term|
results = results & Context.find(:all, :include => :terms,
:conditions => ["term = ?", term])
end
Not as efficient as I'd like, but OK I suppose.
--
Lance Ball
http://lance.langwell-ball.com
_______________________________________________ engine-users mailing list [email protected] http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org
