diff options
author | multiple creatures <dev@multiple-creature.party> | 2020-01-10 03:45:29 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2020-01-10 03:45:29 -0600 |
commit | f03960382bd05b8570e0e3b1066545831c59138a (patch) | |
tree | e7f4b362018e17e2a475a9c2e6988b0ebd79ac5d /app/helpers | |
parent | 4c8591fbeae9054a354f955e37a95aeed369222a (diff) |
switch (back) to postgres fts engine for fast search & timeline filters
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/filter_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/search_helper.rb | 20 |
2 files changed, 1 insertions, 21 deletions
diff --git a/app/helpers/filter_helper.rb b/app/helpers/filter_helper.rb index db2652557..b9dbc1f4f 100644 --- a/app/helpers/filter_helper.rb +++ b/app/helpers/filter_helper.rb @@ -7,7 +7,7 @@ module FilterHelper status = status.reblog if status.reblog? - if Status.where(id: status.id).regex_filtered_by_account(receiver_id).exists? + if Status.where(id: status.id).search_filtered_by_account(receiver_id).exists? redis.sadd("filtered_statuses:#{receiver_id}", status.id) return true end diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb deleted file mode 100644 index 8bddbe187..000000000 --- a/app/helpers/search_helper.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'sixarm_ruby_unaccent' - -module SearchHelper - def expand_search_query(query) - return '' if query.blank? - query = query.downcase.unaccent.gsub(/[^\p{Word} [:punct:]]/, '').gsub(/ +/, ' ').strip - return '' if query.blank? - - if query.include?(':') - query_parts = query.split(':', 2) - if %w(tag tags).include?(query_parts[0]) - query = "^tag (#{query_parts[1].split.join('|')})" - elsif %w(subj text desc).include?(query_parts[0]) - query = "^#{query_parts[0]} .*#{query_parts[1]}" - end - end - - query.gsub(/"(.*)"/, '\\y\1\\y') - end -end |