11908: Migrate collections.properties to jsonb.
[arvados.git] / services / api / app / models / arvados_model.rb
index 0828d016874d3304167c8da8c3f40d8bb964258c..08d7e9345dbb8178d6891821277e6a01958aeacd 100644 (file)
@@ -357,13 +357,14 @@ class ArvadosModel < ActiveRecord::Base
 
   def self.full_text_searchable_columns
     self.columns.select do |col|
-      col.type == :string or col.type == :text
+      [:string, :text, :jsonb].include?(col.type)
     end.map(&:name)
   end
 
   def self.full_text_tsvector
     parts = full_text_searchable_columns.collect do |column|
-      "coalesce(#{column},'')"
+      cast = serialized_attributes[column] ? '::text' : ''
+      "coalesce(#{column}#{cast},'')"
     end
     "to_tsvector('english', #{parts.join(" || ' ' || ")})"
   end