# HG changeset patch # User Sebastien Jodogne # Date 1720722050 -7200 # Node ID 7c11a71927a9c68632ca5f182872768c2367c332 # Parent c352d762177cea5dc83bcf7a713b0f502aa130d7 improved handling of limits diff -r c352d762177c -r 7c11a71927a9 OrthancServer/Sources/Database/FindRequest.h --- a/OrthancServer/Sources/Database/FindRequest.h Tue Jul 09 18:06:21 2024 +0200 +++ b/OrthancServer/Sources/Database/FindRequest.h Thu Jul 11 20:20:50 2024 +0200 @@ -314,6 +314,11 @@ return metadataConstraints_.size(); } + void ClearLimits() + { + hasLimits_ = false; + } + void SetLimits(uint64_t since, uint64_t count); diff -r c352d762177c -r 7c11a71927a9 OrthancServer/Sources/ResourceFinder.cpp --- a/OrthancServer/Sources/ResourceFinder.cpp Tue Jul 09 18:06:21 2024 +0200 +++ b/OrthancServer/Sources/ResourceFinder.cpp Thu Jul 11 20:20:50 2024 +0200 @@ -431,18 +431,20 @@ { request_.SetLimits(0, databaseLimits_ + 1); } - - if (lookup_.get() == NULL || - lookup_->HasOnlyMainDicomTags()) + else { - // TODO-FIND: Understand why this doesn't work: - // $ ./Start.sh --force Orthanc.test_rest_find_limit Orthanc.test_resources_since_limit Orthanc.test_rest_find_limit + request_.ClearLimits(); + } - /*if (hasLimits_) + if (hasLimits_) + { + if (lookup_.get() == NULL) { isDatabasePaging_ = true; request_.SetLimits(limitsSince_, limitsCount_); - }*/ + } + + // TODO-FIND: enable database paging on "simple" lookups that involve no normalization } // TODO-FIND: More cases could be added, depending on "GetDatabaseCapabilities()" @@ -527,7 +529,6 @@ void ResourceFinder::SetDatabaseLookup(const DatabaseLookup& lookup) { lookup_.reset(lookup.Clone()); - UpdateRequestLimits(); for (size_t i = 0; i < lookup.GetConstraintsCount(); i++) { @@ -567,6 +568,8 @@ throw OrthancException(ErrorCode_InternalError); } } + + UpdateRequestLimits(); }