mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-13 16:34:25 +08:00
Merge pull request #1409 from mz3944/mz-SCI-2816
Smart annotations - special characters [SCI-2816]
This commit is contained in:
commit
3fdee2002d
1 changed files with 2 additions and 1 deletions
|
@ -31,6 +31,7 @@ module SearchableModel
|
||||||
a_query = query.split
|
a_query = query.split
|
||||||
.map { |a| Regexp.escape(a) }
|
.map { |a| Regexp.escape(a) }
|
||||||
.join('|')
|
.join('|')
|
||||||
|
a_query = "(#{a_query})"
|
||||||
elsif options[:at_search].to_s == 'true'
|
elsif options[:at_search].to_s == 'true'
|
||||||
a_query = "%#{Regexp.escape(query).downcase}%"
|
a_query = "%#{Regexp.escape(query).downcase}%"
|
||||||
else
|
else
|
||||||
|
@ -49,7 +50,7 @@ module SearchableModel
|
||||||
).join[0..-5]
|
).join[0..-5]
|
||||||
vals = (
|
vals = (
|
||||||
attrs.map.with_index do |_, i|
|
attrs.map.with_index do |_, i|
|
||||||
["t#{i}".to_sym, '\\y(' + a_query + ')\\y']
|
["t#{i}".to_sym, a_query]
|
||||||
end
|
end
|
||||||
).to_h
|
).to_h
|
||||||
return where(where_str, vals)
|
return where(where_str, vals)
|
||||||
|
|
Loading…
Reference in a new issue