comparison OrthancServer/Sources/ResourceFinder.cpp @ 5692:7c11a71927a9 find-refactoring

improved handling of limits
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Jul 2024 20:20:50 +0200
parents 708952bd869c
children 023787ecaff2
comparison
equal deleted inserted replaced
5691:c352d762177c 5692:7c11a71927a9
429 429
430 if (databaseLimits_ != 0) 430 if (databaseLimits_ != 0)
431 { 431 {
432 request_.SetLimits(0, databaseLimits_ + 1); 432 request_.SetLimits(0, databaseLimits_ + 1);
433 } 433 }
434 434 else
435 if (lookup_.get() == NULL || 435 {
436 lookup_->HasOnlyMainDicomTags()) 436 request_.ClearLimits();
437 { 437 }
438 // TODO-FIND: Understand why this doesn't work: 438
439 // $ ./Start.sh --force Orthanc.test_rest_find_limit Orthanc.test_resources_since_limit Orthanc.test_rest_find_limit 439 if (hasLimits_)
440 440 {
441 /*if (hasLimits_) 441 if (lookup_.get() == NULL)
442 { 442 {
443 isDatabasePaging_ = true; 443 isDatabasePaging_ = true;
444 request_.SetLimits(limitsSince_, limitsCount_); 444 request_.SetLimits(limitsSince_, limitsCount_);
445 }*/ 445 }
446
447 // TODO-FIND: enable database paging on "simple" lookups that involve no normalization
446 } 448 }
447 449
448 // TODO-FIND: More cases could be added, depending on "GetDatabaseCapabilities()" 450 // TODO-FIND: More cases could be added, depending on "GetDatabaseCapabilities()"
449 } 451 }
450 452
525 527
526 528
527 void ResourceFinder::SetDatabaseLookup(const DatabaseLookup& lookup) 529 void ResourceFinder::SetDatabaseLookup(const DatabaseLookup& lookup)
528 { 530 {
529 lookup_.reset(lookup.Clone()); 531 lookup_.reset(lookup.Clone());
530 UpdateRequestLimits();
531 532
532 for (size_t i = 0; i < lookup.GetConstraintsCount(); i++) 533 for (size_t i = 0; i < lookup.GetConstraintsCount(); i++)
533 { 534 {
534 DicomTag tag = lookup.GetConstraint(i).GetTag(); 535 DicomTag tag = lookup.GetConstraint(i).GetTag();
535 if (IsComputedTag(tag)) 536 if (IsComputedTag(tag))
565 { 566 {
566 // Sanity check 567 // Sanity check
567 throw OrthancException(ErrorCode_InternalError); 568 throw OrthancException(ErrorCode_InternalError);
568 } 569 }
569 } 570 }
571
572 UpdateRequestLimits();
570 } 573 }
571 574
572 575
573 void ResourceFinder::AddRequestedTag(const DicomTag& tag) 576 void ResourceFinder::AddRequestedTag(const DicomTag& tag)
574 { 577 {