Fix search bug.
This commit is contained in:
parent
9e53640351
commit
22ce8d5f1a
|
@ -181,10 +181,13 @@ class UniversalTablesController < ApplicationController
|
||||||
if params["column"].present?
|
if params["column"].present?
|
||||||
keywords = params["q"]
|
keywords = params["q"]
|
||||||
keywords = keywords.strip.nil? ? keywords : keywords.strip
|
keywords = keywords.strip.nil? ? keywords : keywords.strip
|
||||||
regexes = keywords.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
|
||||||
regex = Regexp.union(regexes.map{|word| Regexp.new(".*"+word+".*", "i")})
|
|
||||||
|
|
||||||
column = table.table_columns.where(:key => params["column"]).first
|
column = table.table_columns.where(:key => params["column"]).first
|
||||||
|
if column.make_categorizable
|
||||||
|
regex = Regexp.new(".*"+keywords+".*", "i")
|
||||||
|
else
|
||||||
|
regexes = keywords.split(/\s+(?=(?:[^"]*"[^"]*")*[^"]*$)/)
|
||||||
|
regex = Regexp.union(regexes.map{|word| Regexp.new(".*"+word+".*", "i")})
|
||||||
|
end
|
||||||
if params["sort"].present?
|
if params["sort"].present?
|
||||||
column_to_sort = table.table_columns.where(:key => params["sortcolumn"]).first
|
column_to_sort = table.table_columns.where(:key => params["sortcolumn"]).first
|
||||||
case column_to_sort.type
|
case column_to_sort.type
|
||||||
|
|
Loading…
Reference in New Issue