diff --git a/app/models/concerns/searchable_model.rb b/app/models/concerns/searchable_model.rb index a0428a3e5..5a51ecb9f 100644 --- a/app/models/concerns/searchable_model.rb +++ b/app/models/concerns/searchable_model.rb @@ -187,8 +187,8 @@ module SearchableModel "#{a} IS NOT NULL AND (((#{a})::text) #{like} :t#{i}) OR " elsif defined?(model::PREFIXED_ID_SQL) && a == model::PREFIXED_ID_SQL "#{a} IS NOT NULL AND (#{a} #{like} :t#{i}) OR " - elsif a == 'asset_text_data.data_vector' - "asset_text_data.data_vector @@ plainto_tsquery(:t#{i})) OR" + elsif ['asset_text_data.data_vector', 'tables.data_vector'].include?(a) + "#{a} @@ plainto_tsquery(:t#{i}) OR " else "#{a} IS NOT NULL AND ((trim_html_tags(#{a})) #{like} :t#{i}) OR " end diff --git a/app/models/protocol.rb b/app/models/protocol.rb index 2c826461c..a1a69b3d8 100644 --- a/app/models/protocol.rb +++ b/app/models/protocol.rb @@ -6,7 +6,7 @@ class Protocol < ApplicationRecord include ArchivableModel include PrefixedIdModel SEARCHABLE_ATTRIBUTES = ['protocols.name', 'protocols.description', PREFIXED_ID_SQL, 'steps.name', - 'step_texts.name', 'step_texts.text', 'tables.name', + 'step_texts.name', 'step_texts.text', 'tables.name', 'tables.data_vector', 'checklists.name', 'checklist_items.text', 'comments.message'].freeze REPOSITORY_TYPES = %i(in_repository_published_original in_repository_draft in_repository_published_version).freeze @@ -204,8 +204,9 @@ class Protocol < ApplicationRecord .where(protocol: raw_input) .where_attributes_like_boolean(['steps.name', 'step_texts.name', 'step_texts.text', 'tables.name', - 'comments.message', 'checklists.name', - 'checklist_items.text'], query) + 'tables.data_vector', 'comments.message', + 'checklists.name', 'checklist_items.text'], + query) .select(:protocol_id))) end diff --git a/app/models/result.rb b/app/models/result.rb index 167a58f94..caab15ba6 100644 --- a/app/models/result.rb +++ b/app/models/result.rb @@ -10,7 +10,7 @@ class Result < ApplicationRecord validates :name, length: { maximum: Constants::NAME_MAX_LENGTH } SEARCHABLE_ATTRIBUTES = ['results.name', 'result_texts.name', 'result_texts.text', - 'tables.name', 'comments.message'].freeze + 'tables.name', 'tables.data_vector', 'comments.message'].freeze enum assets_view_mode: { thumbnail: 0, list: 1, inline: 2 }