diff --git a/assets/js/match_query.js b/assets/js/match_query.js index b8a790af..ae9a87ae 100644 --- a/assets/js/match_query.js +++ b/assets/js/match_query.js @@ -20,7 +20,7 @@ const tokenList = [ ], numberFields = ['id', 'width', 'height', 'aspect_ratio', 'comment_count', 'score', 'upvotes', 'downvotes', - 'faves'], + 'faves', 'tag_count'], dateFields = ['created_at'], literalFields = ['tags', 'orig_sha512_hash', 'sha512_hash', 'score', 'uploader', 'source_url', 'description'], @@ -37,6 +37,7 @@ const tokenList = [ height: 'data-height', aspect_ratio: 'data-aspect-ratio', comment_count: 'data-comment-count', + tag_count: 'data-tag-count', source_url: 'data-source-url', faves: 'data-faves', sha512_hash: 'data-sha512', diff --git a/lib/philomena_web/views/image_view.ex b/lib/philomena_web/views/image_view.ex index 0295dbd4..9015ce55 100644 --- a/lib/philomena_web/views/image_view.ex +++ b/lib/philomena_web/views/image_view.ex @@ -128,6 +128,7 @@ defmodule PhilomenaWeb.ImageView do image_id: image.id, image_tags: Jason.encode!(Enum.map(image.tags, & &1.id)), image_tag_aliases: image.tag_list_plus_alias_cache, + tag_count: length(image.tags), score: image.score, faves: image.faves_count, upvotes: image.upvotes_count, @@ -220,6 +221,7 @@ defmodule PhilomenaWeb.ImageView do %{ id: image.id, "namespaced_tags.name": String.split(image.tag_list_plus_alias_cache || "", ", "), + tag_count: length(image.tags), score: image.score, faves: image.faves_count, upvotes: image.upvotes_count,