15531: Test federation migrate script WIP
[arvados.git] / services / api / lib / record_filters.rb
index 831e357b4235b6b11217de47ee2c5960a4ef3563..c8f024291c2c677c086445b294658a3c221211c0 100644 (file)
@@ -44,6 +44,14 @@ module RecordFilters
 
       cond_out = []
 
+      if attrs_in == 'any' && (operator.casecmp('ilike').zero? || operator.casecmp('like').zero?) && (operand.is_a? String) && operand.match('^[%].*[%]$')
+        # Trigram index search
+        cond_out << model_class.full_text_trgm + " #{operator} ?"
+        param_out << operand
+        # Skip the generic per-column operator loop below
+        attrs = []
+      end
+
       if operator == '@@'
         # Full-text search
         if attrs_in != 'any'