pull/721/head
Pete Matsyburka 3 weeks ago
parent c18e263f34
commit 4626518c83

@ -236,10 +236,12 @@ module SearchEntries
end
def add_hyphens(entry, text)
text = text.tr('\\', ' ')
hyphens = text.scan(/\b[^\s]*?\d-[^\s]+?\b/) + text.scan(/\b[^\s]+-\d[^\s]*?\b/)
hyphens.uniq.each_with_index do |item, index|
entry.tsvector += " '#{item.delete("'\\")}':#{index + 1}" unless entry.tsvector.include?(item)
entry.tsvector += " '#{item.delete("'")}':#{index + 1}" unless entry.tsvector.include?(item)
end
entry

@ -49,7 +49,7 @@ module Submitters
end
def fulltext_search_field(current_user, submitters, keyword, field_name)
keyword = keyword.delete("\0\\")
keyword = keyword.delete("\0").tr('\\', ' ').squish
return submitters.none if keyword.blank?

Loading…
Cancel
Save