# HG changeset patch # User Alain Mazy # Date 1730971648 -3600 # Node ID 022ce5323d098299dd38b358759c691bd8d1d2a3 # Parent 5c484b4f99d52026b404815da6ba461c181e938d fix children count in GenericFind diff -r 5c484b4f99d5 -r 022ce5323d09 OrthancServer/Sources/Database/Compatibility/GenericFind.cpp --- a/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Wed Nov 06 19:25:30 2024 +0100 +++ b/OrthancServer/Sources/Database/Compatibility/GenericFind.cpp Thu Nov 07 10:27:28 2024 +0100 @@ -550,7 +550,8 @@ { ResourceType childrenLevel = GetChildResourceType(currentLevel); - if (request.GetChildrenSpecification(childrenLevel).IsRetrieveIdentifiers()) + if (request.GetChildrenSpecification(childrenLevel).IsRetrieveIdentifiers() || + request.GetChildrenSpecification(childrenLevel).IsRetrieveCount()) { for (std::list::const_iterator it = currentIds.begin(); it != currentIds.end(); ++it) { @@ -561,6 +562,7 @@ { resource->AddChildIdentifier(childrenLevel, *it2); } + resource->IncrementChildrenCount(childrenLevel, ids.size()); } } diff -r 5c484b4f99d5 -r 022ce5323d09 OrthancServer/Sources/Database/FindRequest.h --- a/OrthancServer/Sources/Database/FindRequest.h Wed Nov 06 19:25:30 2024 +0100 +++ b/OrthancServer/Sources/Database/FindRequest.h Thu Nov 07 10:27:28 2024 +0100 @@ -236,7 +236,7 @@ bool IsOfInterest() const { - return (identifiers_ || !metadata_.empty() || !mainDicomTags_.empty()); + return (identifiers_ || !metadata_.empty() || !mainDicomTags_.empty() || count_); } }; diff -r 5c484b4f99d5 -r 022ce5323d09 OrthancServer/Sources/Database/FindResponse.h --- a/OrthancServer/Sources/Database/FindResponse.h Wed Nov 06 19:25:30 2024 +0100 +++ b/OrthancServer/Sources/Database/FindResponse.h Thu Nov 07 10:27:28 2024 +0100 @@ -97,6 +97,11 @@ count_ = count; } + void IncrementCount(uint64_t count) + { + count_ += count; + } + uint64_t GetCount() const { return count_; @@ -294,6 +299,12 @@ GetChildrenInformation(level).SetCount(count); } + void IncrementChildrenCount(ResourceType level, + uint64_t count) + { + GetChildrenInformation(level).IncrementCount(count); + } + uint64_t GetChildrenCount(ResourceType level) const { return GetChildrenInformation(level).GetCount();