diff --git a/app/logical/post_query_builder.rb b/app/logical/post_query_builder.rb index 4046485f1..a694e7f75 100644 --- a/app/logical/post_query_builder.rb +++ b/app/logical/post_query_builder.rb @@ -985,6 +985,11 @@ class PostQueryBuilder def is_wildcard_search? is_single_tag? && tags.first.wildcard end + + def simple_tag + return nil if !is_simple_tag? + Tag.find_by_name(tags.first.name) + end end memoize :split_query, :normalized_query diff --git a/app/logical/related_tag_query.rb b/app/logical/related_tag_query.rb index 6a86b10b0..fb6c71413 100644 --- a/app/logical/related_tag_query.rb +++ b/app/logical/related_tag_query.rb @@ -71,9 +71,12 @@ class RelatedTagQuery end def other_wiki_pages - if Tag.category_for(query) == Tag.categories.copyright + tag = post_query.simple_tag + return [] if tag.nil? + + if tag.copyright? copyright_other_wiki_pages - elsif Tag.category_for(query) == Tag.categories.general + elsif tag.general? general_other_wiki_pages else [] diff --git a/app/models/tag.rb b/app/models/tag.rb index 527f8a797..c83d4e9b1 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -127,18 +127,6 @@ class Tag < ApplicationRecord Tag.where(name: tag_name).pick(:category).to_i end - def category_for(tag_name, options = {}) - return Tag.categories.general if tag_name.blank? - - if options[:disable_caching] - select_category_for(tag_name) - else - Cache.get("tc:#{Cache.hash(tag_name)}") do - select_category_for(tag_name) - end - end - end - def categories_for(tag_names, options = {}) if options[:disable_caching] Array(tag_names).inject({}) do |hash, tag_name| diff --git a/app/views/explore/posts/missed_searches.html.erb b/app/views/explore/posts/missed_searches.html.erb index 329b66c43..1bad6c802 100644 --- a/app/views/explore/posts/missed_searches.html.erb +++ b/app/views/explore/posts/missed_searches.html.erb @@ -15,11 +15,11 @@
- <% @missed_searches.each do |tags, count| %> -