Fix #3208: Fix translated tag suggestions for Pixiv.
* Only suggest the Danbooru tag with the same name if there is no matching wiki other name. Example: if we have the Pixiv tag `Fate` and the Danbooru tag `fate_(series)` with other name `fate`, suggest that, not the Danbooru tag `fate`. * Don't suggest tags that are empty or whose wiki is deleted. * Only split tags on "/" if there are no other matches, and only for Pixiv. * For Pixiv, only include traditional media tags in tag list, not digital media (Photoshop, SAI). * Add some tests.
This commit is contained in:
@@ -787,6 +787,10 @@ class Tag < ApplicationRecord
|
||||
end
|
||||
|
||||
module SearchMethods
|
||||
def nonempty
|
||||
where("tags.post_count > 0")
|
||||
end
|
||||
|
||||
def name_matches(name)
|
||||
where("tags.name LIKE ? ESCAPE E'\\\\'", name.mb_chars.downcase.to_escaped_for_sql_like)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user