X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/002aec2a7db39d269bb3c9123783022c2e32a5cc..91aeea6d741f2bec6ecdc32d24537cf0f2a7328a:/services/api/lib/record_filters.rb diff --git a/services/api/lib/record_filters.rb b/services/api/lib/record_filters.rb index 994e850310..5688ca6140 100644 --- a/services/api/lib/record_filters.rb +++ b/services/api/lib/record_filters.rb @@ -19,7 +19,7 @@ module RecordFilters # +model_class+ subclass of ActiveRecord being filtered # # Output: - # Hash with two keys: + # Hash with the following keys: # :cond_out array of SQL fragments for each filter expression # :param_out array of values for parameter substitution in cond_out # :joins array of joins: either [] or ["JOIN containers ON ..."] @@ -140,6 +140,10 @@ module RecordFilters raise ArgumentError.new("Invalid operand '#{operand}' for '#{operator}' must be true or false") end param_out << proppath + when 'contains' + cond_out << "#{attr_table_name}.#{attr} @> ?::jsonb OR #{attr_table_name}.#{attr} @> ?::jsonb" + param_out << SafeJSON.dump({proppath => operand}) + param_out << SafeJSON.dump({proppath => [operand]}) else raise ArgumentError.new("Invalid operator for subproperty search '#{operator}'") end