mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-17 14:32:34 +08:00
Merge pull request #8894 from artoscinote/ma_SCI_12277
Fix search for combination of NOT and searching by NULL columns [SCI-12277]
This commit is contained in:
commit
04ade3970d
1 changed files with 4 additions and 4 deletions
|
|
@ -124,13 +124,13 @@ module SearchableModel
|
|||
if attribute == :children
|
||||
"\"#{table_name}\".\"id\" IN (#{where_children_attributes_like(token[:value]).select(:id).to_sql}) OR "
|
||||
elsif SEARCH_NUMBER_ATTRIBUTES.include?(attribute)
|
||||
"(#{attribute}::text #{like} ?) OR "
|
||||
"(#{attribute} IS NOT NULL AND #{attribute}::text #{like} ?) OR "
|
||||
elsif defined?(model::PREFIXED_ID_SQL) && attribute == model::PREFIXED_ID_SQL
|
||||
"#{attribute} #{like} ? OR "
|
||||
"(#{attribute} IS NOT NULL AND #{attribute} #{like} ?) OR "
|
||||
elsif SEARCH_DATA_VECTOR_ATTRIBUTES.include?(attribute)
|
||||
"#{attribute} @@ plainto_tsquery(?) OR "
|
||||
"(#{attribute} IS NOT NULL AND #{attribute} @@ plainto_tsquery(?)) OR "
|
||||
else
|
||||
"trim_html_tags(#{attribute}) #{like} ? OR "
|
||||
"(#{attribute} IS NOT NULL AND trim_html_tags(#{attribute}) #{like} ?) OR "
|
||||
end
|
||||
end).join[0..-5]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue