about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-11-16 07:17:15 -0600
committermultiple creatures <dev@multiple-creature.party>2019-11-16 07:17:15 -0600
commit6abae51e47753cc80b440c4234c14cd8232e235f (patch)
treeeb3d71fece5419b882d6128c1ab0e130e121c40a /app/lib
parent9de5952f4e92528a1dd664c188d730229493b707 (diff)
Regular expressions can now be used in full-text searches. Wrapping a search term in double-quotes treats it as a whole-word match.
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/bangtags.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/lib/bangtags.rb b/app/lib/bangtags.rb
index 681fa4abc..60fb426b3 100644
--- a/app/lib/bangtags.rb
+++ b/app/lib/bangtags.rb
@@ -2,6 +2,8 @@
 
 class Bangtags
   include ModerationHelper
+  include SearchHelper
+
   attr_reader :status, :account
 
   def initialize(status)
@@ -718,7 +720,7 @@ class Bangtags
           q = cmd[1..-1].join.strip
           next if q.blank?
           begin
-            data = @account.statuses.where('text ILIKE ?', "%#{sanitize_sql_like(q)}%")
+            data = @account.statuses.where('text ~* ?', expand_search_query(q))
               .reorder(:created_at)
               .pluck(:created_at)
               .map { |d| d.strftime('%Y-%m') }