mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-01 20:48:23 +08:00
Add search support for numeric
This commit is contained in:
parent
87288d0771
commit
c15bcf0769
2 changed files with 4 additions and 2 deletions
|
@ -44,7 +44,7 @@ module SearchableModel
|
|||
"CAST(#{a} AS TEXT) #{like} :t#{i} OR "
|
||||
else
|
||||
col = options[:at_search].to_s == 'true' ? "lower(#{a})": a
|
||||
"(trim_html_tags(#{col})) #{like} :t#{i} OR "
|
||||
"(trim_html_tags((#{col})::text)) #{like} :t#{i} OR "
|
||||
end
|
||||
end
|
||||
).join[0..-5]
|
||||
|
@ -86,7 +86,7 @@ module SearchableModel
|
|||
if a == 'repository_rows.id'
|
||||
"CAST(#{a} AS TEXT) #{like} :t#{i} OR "
|
||||
else
|
||||
"(trim_html_tags(#{a})) #{like} :t#{i} OR "
|
||||
"(trim_html_tags((#{a})::text)) #{like} :t#{i} OR "
|
||||
end
|
||||
end
|
||||
).join[0..-5]
|
||||
|
|
|
@ -62,6 +62,7 @@ class Extends
|
|||
# Extra attributes used for search in repositories, text columns
|
||||
# are only supported
|
||||
REPOSITORY_EXTRA_SEARCH_ATTR = ['repository_text_values.data',
|
||||
'repository_number_values.data',
|
||||
'repository_list_items.data',
|
||||
'repository_checklist_items.data',
|
||||
'repository_status_items.status',
|
||||
|
@ -69,6 +70,7 @@ class Extends
|
|||
|
||||
# Array of includes used in search query for repository rows
|
||||
REPOSITORY_SEARCH_INCLUDES = [:repository_text_value,
|
||||
:repository_number_value,
|
||||
repository_list_value: :repository_list_item,
|
||||
repository_checklist_value: :repository_checklist_items,
|
||||
repository_status_value: :repository_status_item,
|
||||
|
|
Loading…
Reference in a new issue