integrate parser; use parser instead of regex query

This commit is contained in:
Bilal Catic
2020-02-03 09:28:27 +01:00
parent 2749c53aac
commit 0eb85eaec2
4 changed files with 157 additions and 2 deletions

View File

@@ -3,7 +3,7 @@
require 'active_support'
require 'squeel'
require_relative './text_to_tsquery'
require_relative './text_to_regex_query'
require_relative './text_to_sql_query'
module PgSearchable
extend ActiveSupport::Concern
@@ -48,7 +48,7 @@ module PgSearchable
def ts_search(value)
return if @ts_search_fields.blank? || value.blank?
TextToRegexQuery.new(value, @ts_search_fields, @default_field, @ts_search_fields_mappings).where_clause( includes(@ts_joins).references(:all))
TextToSqlQuery.new(value, @ts_search_fields, @default_field, @ts_search_fields_mappings).where_clause( includes(@ts_joins).references(:all))
end
def should_update_cache_field?