Update app/controllers/universal_tables_controller.rb
changed to full string search instead of splitting words
This commit is contained in:
parent
7c4102d61b
commit
fc39a817ab
|
@ -258,12 +258,13 @@ class UniversalTablesController < ApplicationController
|
||||||
q.each do |k, v|
|
q.each do |k, v|
|
||||||
column = table.table_columns.where(:key => k).first
|
column = table.table_columns.where(:key => k).first
|
||||||
next if column.nil?
|
next if column.nil?
|
||||||
if column.make_categorizable
|
# if column.make_categorizable
|
||||||
regex = Regexp.new(".*"+v+".*", "i")
|
# regex = Regexp.new(".*"+v+".*", "i")
|
||||||
else
|
# else
|
||||||
regexes = v.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
# regexes = v.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
||||||
regex = Regexp.union(regexes.map{|word| Regexp.new(".*"+word+".*", "i")})
|
# regex = Regexp.union(regexes.map{|word| Regexp.new(".*"+word+".*", "i")})
|
||||||
end
|
# end
|
||||||
|
regex = Regexp.new(".*"+v+".*", "i")
|
||||||
if column.type == "text"
|
if column.type == "text"
|
||||||
columns = column.column_entries.any_of([{"text.en" => regex}, {"text.zh_tw" => regex}])
|
columns = column.column_entries.any_of([{"text.en" => regex}, {"text.zh_tw" => regex}])
|
||||||
elsif column.type == "editor"
|
elsif column.type == "editor"
|
||||||
|
|
Loading…
Reference in New Issue