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|
|
||||
column = table.table_columns.where(:key => k).first
|
||||
next if column.nil?
|
||||
if column.make_categorizable
|
||||
regex = Regexp.new(".*"+v+".*", "i")
|
||||
else
|
||||
regexes = v.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
||||
regex = Regexp.union(regexes.map{|word| Regexp.new(".*"+word+".*", "i")})
|
||||
end
|
||||
# if column.make_categorizable
|
||||
# regex = Regexp.new(".*"+v+".*", "i")
|
||||
# else
|
||||
# regexes = v.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
||||
# regex = Regexp.union(regexes.map{|word| Regexp.new(".*"+word+".*", "i")})
|
||||
# end
|
||||
regex = Regexp.new(".*"+v+".*", "i")
|
||||
if column.type == "text"
|
||||
columns = column.column_entries.any_of([{"text.en" => regex}, {"text.zh_tw" => regex}])
|
||||
elsif column.type == "editor"
|
||||
|
|
Loading…
Reference in New Issue