Permalink
Browse files

fixed unicodeutils dependency

  • Loading branch information...
1 parent 119ece2 commit 02dec6c12b5237a6d432e51ce5e1c804d81ad79c Tomas Jogin committed Nov 17, 2011
Showing with 6 additions and 4 deletions.
  1. +5 −3 lib/naive-search/naive_search_on.rb
  2. +1 −1 lib/naive-search/version.rb
@@ -1,3 +1,5 @@
+require 'unicode_utils/downcase'
+
module NaiveSearch
module NaiveSearchOn
extend ActiveSupport::Concern
@@ -19,7 +21,7 @@ def naive_search_on(*fields)
end
def search_for(query, page_no = 1, page_size = nil)
- words = UnicodeUtils.downcase(query.to_s).split " "
+ words = ::UnicodeUtils.downcase(query.to_s).split " "
conditions = words.map do |w|
replace_bind_variables("#{self.naive_search_index_field} like ?", ["%#{w}%"])
end.join " OR "
@@ -34,7 +36,7 @@ def search_for(query, page_no = 1, page_size = nil)
end
def relevance_for(query)
- query = UnicodeUtils.downcase query.to_s
+ query = ::UnicodeUtils.downcase query.to_s
@naive_relevance ||= {}
return @naive_relevance[query] if @naive_relevance[query]
words = query.split " "
@@ -59,7 +61,7 @@ def relevance_for(query)
private
def update_naive_search_index
full_text = self.naive_search_fields.map do |field|
- UnicodeUtils.downcase self.send(field).to_s
+ ::UnicodeUtils.downcase self.send(field).to_s
end.join "\n"
self.send "#{self.naive_search_index_field}=", full_text
end
@@ -1,3 +1,3 @@
module NaiveSearch
- VERSION = "0.1.6"
+ VERSION = "0.1.7"
end

0 comments on commit 02dec6c

Please sign in to comment.