fix search

This commit is contained in:
Pete Matsyburka committed 2026-08-29 20:06:14 +03:00
1 parent c18e263f34
commit 4626518c83
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -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
+1 -1
View File
@@ -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?