Correctly count tag categories

If multiple tags of the same category are applied to the same item,
just summing tag counts will produce the wrong results as now items
are counted multiple times.
This commit is contained in:
Eike Kettner
2021-04-11 13:57:49 +02:00
parent 132730b19c
commit 3e0914ece7
10 changed files with 79 additions and 8 deletions

View File

@ -31,6 +31,7 @@ trait Conversions {
SearchStats(
sum.count,
mkTagCloud(sum.tags),
mkTagCategoryCloud(sum.cats),
sum.fields.map(mkFieldStats),
sum.folders.map(mkFolderStats)
)
@ -63,6 +64,9 @@ trait Conversions {
def mkTagCloud(tags: List[OCollective.TagCount]) =
TagCloud(tags.map(tc => TagCount(mkTag(tc.tag), tc.count)))
def mkTagCategoryCloud(tags: List[OCollective.CategoryCount]) =
NameCloud(tags.map(tc => NameCount(tc.category, tc.count)))
// attachment meta
def mkAttachmentMeta(rm: RAttachmentMeta): AttachmentMeta =
AttachmentMeta(