app/models/concerns/agilibox/search.rb in agilibox-1.0.3 vs app/models/concerns/agilibox/search.rb in agilibox-1.0.4
- old
+ new
@@ -12,10 +12,10 @@
words = q.to_s.parameterize.split("-")
fields = default_search_fields if fields.empty?
sql_query = words.map.with_index do |word, index|
fields.map do |field|
- "(LOWER(CAST(#{field} AS TEXT)) LIKE :w#{index})"
+ "(UNACCENT(CAST(#{field} AS TEXT)) ILIKE :w#{index})"
end.join(" OR ")
end.map{ |e| "(#{e})" }.join(" AND ")
sql_params_a = words.map.with_index do |word, index|
["w#{index}".to_sym, "%#{word}%"]