Fix #4016: Translated tags failing to find some tags.
* Normalize spaces to underscores when saving other names. Preserve case since case can be significant. * Fix WikiPage#other_names_include to search case-insensitively (note: this prevents using the index). * Fix sources to return the raw tags in `#tags` and the normalized tags in `#normalized_tags`. The normalized tags are the tags that will be matched against other names.
This commit is contained in:
@@ -160,14 +160,16 @@ module Sources
|
||||
rescue PixivApiClient::BadIDError
|
||||
[]
|
||||
end
|
||||
memoize :tags
|
||||
|
||||
def normalize_tag(tag)
|
||||
tag.gsub(/\d+users入り\z/i, "")
|
||||
end
|
||||
|
||||
def translate_tag(tag)
|
||||
normalized_tag = tag.gsub(/\d+users入り\z/i, "")
|
||||
translated_tags = super(normalized_tag)
|
||||
translated_tags = super(tag)
|
||||
|
||||
if translated_tags.empty? && normalized_tag.include?("/")
|
||||
translated_tags = normalized_tag.split("/").flat_map { |tag| super(tag) }
|
||||
if translated_tags.empty? && tag.include?("/")
|
||||
translated_tags = tag.split("/").flat_map { |tag| super(tag) }
|
||||
end
|
||||
|
||||
translated_tags
|
||||
|
||||
Reference in New Issue
Block a user