From fc39a817abaab0a885402855ac460351a0126daa Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 22 Aug 2024 12:59:25 +0000 Subject: [PATCH] Update app/controllers/universal_tables_controller.rb changed to full string search instead of splitting words --- app/controllers/universal_tables_controller.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/controllers/universal_tables_controller.rb b/app/controllers/universal_tables_controller.rb index 11e44ff..beb411b 100644 --- a/app/controllers/universal_tables_controller.rb +++ b/app/controllers/universal_tables_controller.rb @@ -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"