Mercurial > hg > orthanc
comparison OrthancServer/ServerContext.cpp @ 3031:18a2d196414b db-changes
simplification
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 19 Dec 2018 13:08:04 +0100 |
parents | ea653ec47f31 |
children | 5da6d1063d8f |
comparison
equal
deleted
inserted
replaced
3030:25afa7b8cb51 | 3031:18a2d196414b |
---|---|
778 const DatabaseLookup& lookup2, | 778 const DatabaseLookup& lookup2, |
779 size_t since, | 779 size_t since, |
780 size_t limit) | 780 size_t limit) |
781 { | 781 { |
782 LookupMode mode; | 782 LookupMode mode; |
783 unsigned int databaseLimit; | |
783 | 784 |
784 { | 785 { |
785 // New configuration option in 1.5.1 | 786 // New configuration option in 1.5.1 |
786 OrthancConfiguration::ReaderLock lock; | 787 OrthancConfiguration::ReaderLock lock; |
787 | 788 |
803 { | 804 { |
804 throw OrthancException(ErrorCode_ParameterOutOfRange, | 805 throw OrthancException(ErrorCode_ParameterOutOfRange, |
805 "Configuration option \"StorageAccessOnFind\" " | 806 "Configuration option \"StorageAccessOnFind\" " |
806 "should be \"Always\", \"Never\" or \"Answers\": " + value); | 807 "should be \"Always\", \"Never\" or \"Answers\": " + value); |
807 } | 808 } |
809 | |
810 if (lookup.GetLevel() == ResourceType_Instance) | |
811 { | |
812 databaseLimit = lock.GetConfiguration().GetUnsignedIntegerParameter("LimitFindInstances", 0); | |
813 } | |
814 else | |
815 { | |
816 databaseLimit = lock.GetConfiguration().GetUnsignedIntegerParameter("LimitFindResults", 0); | |
817 } | |
808 } | 818 } |
809 | 819 |
810 | 820 |
811 std::vector<std::string> resources, instances; | 821 std::vector<std::string> resources, instances; |
812 GetIndex().FindCandidates(resources, instances, lookup); | 822 GetIndex().FindCandidates(resources, instances, lookup); |
815 | 825 |
816 #if 1 | 826 #if 1 |
817 { | 827 { |
818 std::vector<std::string> resources2, instances2; | 828 std::vector<std::string> resources2, instances2; |
819 | 829 |
820 size_t lookupLimit = (limit == 0 ? 0 : limit + 1); | 830 size_t lookupLimit = (databaseLimit == 0 ? 0 : databaseLimit + 1); |
821 | 831 GetIndex().ApplyLookupResources(resources2, instances2, lookup2, lookup.GetLevel(), lookupLimit); |
822 if (lookup.GetLevel() == ResourceType_Patient) | 832 |
823 { | 833 if (databaseLimit != 0 && |
824 GetIndex().ApplyLookupPatients(resources2, instances2, lookup2, lookupLimit); | 834 resources2.size() > databaseLimit) |
825 } | |
826 else | |
827 { | |
828 GetIndex().ApplyLookupResources(resources2, instances2, lookup2, | |
829 lookup.GetLevel(), lookupLimit); | |
830 } | |
831 | |
832 if (limit != 0 && | |
833 resources2.size() > limit) | |
834 { | 835 { |
835 complete = false; | 836 complete = false; |
836 } | 837 } |
837 | 838 |
838 // Sanity checks | 839 // Sanity checks |
841 { | 842 { |
842 r.insert(resources2[i]); | 843 r.insert(resources2[i]); |
843 } | 844 } |
844 | 845 |
845 printf("%d %d\n", resources2.size(), resources.size()); | 846 printf("%d %d\n", resources2.size(), resources.size()); |
846 /*assert(resources2.size() >= resources.size()); | 847 assert(resources2.size() >= resources.size()); |
847 | 848 |
848 for (size_t i = 0; i < resources.size(); i++) | 849 for (size_t i = 0; i < resources.size(); i++) |
849 { | 850 { |
850 assert(r.find(resources[i]) != r.end()); | 851 assert(r.find(resources[i]) != r.end()); |
851 }*/ | 852 } |
852 } | 853 } |
853 #endif | 854 #endif |
854 | 855 |
855 LOG(INFO) << "Number of candidate resources after fast DB filtering on main DICOM tags: " << resources.size(); | 856 LOG(INFO) << "Number of candidate resources after fast DB filtering on main DICOM tags: " << resources.size(); |
856 | 857 |