tag.rb: remove unused find_suggestions, increment_view_count.

find_suggestions unused since ca3e9bb.
This commit is contained in:
evazion
2017-02-05 16:44:44 -06:00
parent 23038de470
commit 74b8ebe580

View File

@@ -79,12 +79,6 @@ class Tag < ActiveRecord::Base
end end
end end
module ViewCountMethods
def increment_view_count(name)
Cache.incr("tvc:#{Cache.sanitize(name)}")
end
end
module CategoryMethods module CategoryMethods
module ClassMethods module ClassMethods
def categories def categories
@@ -694,20 +688,6 @@ class Tag < ActiveRecord::Base
end end
end end
module SuggestionMethods
def find_suggestions(query)
query_tokens = query.split(/_/)
if query_tokens.size == 2
search_for = query_tokens.reverse.join("_").to_escaped_for_sql_like
else
search_for = "%" + query.to_escaped_for_sql_like + "%"
end
Tag.where(["name LIKE ? ESCAPE E'\\\\' AND post_count > 0 AND name <> ?", search_for, query]).order("post_count DESC").limit(6).select("name").map(&:name).sort
end
end
module SearchMethods module SearchMethods
def name_matches(name) def name_matches(name)
where("tags.name LIKE ? ESCAPE E'\\\\'", name.mb_chars.downcase.to_escaped_for_sql_like) where("tags.name LIKE ? ESCAPE E'\\\\'", name.mb_chars.downcase.to_escaped_for_sql_like)
@@ -789,12 +769,10 @@ class Tag < ActiveRecord::Base
include ApiMethods include ApiMethods
include CountMethods include CountMethods
extend ViewCountMethods
include CategoryMethods include CategoryMethods
extend StatisticsMethods extend StatisticsMethods
extend NameMethods extend NameMethods
extend ParseMethods extend ParseMethods
include RelationMethods include RelationMethods
extend SuggestionMethods
extend SearchMethods extend SearchMethods
end end