Skip to content

Commit

Permalink
Dry code
Browse files Browse the repository at this point in the history
  • Loading branch information
smix committed Jan 7, 2011
1 parent 22a6cb6 commit 0530ac8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/mongoid_search/mongoid_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ def search(query, options={})

def search_relevant(query, options={})
return self.all if query.blank? && allow_empty_search
#self.send("#{(options[:match]||self.match).to_s}_in", :_keywords => KeywordsExtractor.extract(query).map { |q| /#{q}/ })

keywords = KeywordsExtractor.extract(query)

map = <<-EOS
function() {
var entries = 0;
var entries = 0
for(i in keywords)
for(j in this._keywords) {
if(this._keywords[j] == keywords[i])
entries++;
entries++
}
if(entries > 0)
emit(this._id, entries)
Expand Down

0 comments on commit 0530ac8

Please sign in to comment.