projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
3126: Accept remote http/https/git url as repository attr in jobs.create/save.
[arvados.git]
/
services
/
api
/
lib
/
record_filters.rb
diff --git
a/services/api/lib/record_filters.rb
b/services/api/lib/record_filters.rb
index 3786a709904e3dc1ca2b217085cec0809998fbb5..350c3802fc60e606fd0dba703429ca7dc98f847e 100644
(file)
--- a/
services/api/lib/record_filters.rb
+++ b/
services/api/lib/record_filters.rb
@@
-42,13
+42,16
@@
module RecordFilters
if attrs_in != 'any'
raise ArgumentError.new("Full text search on individual columns is not supported")
end
if attrs_in != 'any'
raise ArgumentError.new("Full text search on individual columns is not supported")
end
+ if operand.is_a? Array
+ raise ArgumentError.new("Full text search not supported for array operands")
+ end
+
# Skip the generic per-column operator loop below
attrs = []
# Use to_tsquery since plainto_tsquery does not support prefix
# Skip the generic per-column operator loop below
attrs = []
# Use to_tsquery since plainto_tsquery does not support prefix
- # search. Instead split operand, add ':*' to each word and
- # join the words with ' & '
+ # search. And, split operand and join the words with ' & '
cond_out << model_class.full_text_tsvector+" @@ to_tsquery(?)"
cond_out << model_class.full_text_tsvector+" @@ to_tsquery(?)"
- param_out << operand.split.
each {|s| s.concat(':*')}.
join(' & ')
+ param_out << operand.split.join(' & ')
end
attrs.each do |attr|
if !model_class.searchable_columns(operator).index attr.to_s
end
attrs.each do |attr|
if !model_class.searchable_columns(operator).index attr.to_s
@@
-74,7
+77,12
@@
module RecordFilters
"boolean attribute '#{attr}'")
end
end
"boolean attribute '#{attr}'")
end
end
- cond_out << "#{ar_table_name}.#{attr} #{operator} ?"
+ if operator == '<>'
+ # explicitly allow NULL
+ cond_out << "#{ar_table_name}.#{attr} #{operator} ? OR #{ar_table_name}.#{attr} IS NULL"
+ else
+ cond_out << "#{ar_table_name}.#{attr} #{operator} ?"
+ end
if (# any operator that operates on value rather than
# representation:
operator.match(/[<=>]/) and (attr_type == :datetime))
if (# any operator that operates on value rather than
# representation:
operator.match(/[<=>]/) and (attr_type == :datetime))