diff OrthancServer/ServerContext.cpp @ 3027:fd587cf51a89 db-changes

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 18 Dec 2018 12:50:27 +0100
parents 039a9d262d64
children ea653ec47f31
line wrap: on
line diff
--- a/OrthancServer/ServerContext.cpp	Mon Dec 17 17:05:28 2018 +0100
+++ b/OrthancServer/ServerContext.cpp	Tue Dec 18 12:50:27 2018 +0100
@@ -811,19 +811,31 @@
     std::vector<std::string> resources, instances;
     GetIndex().FindCandidates(resources, instances, lookup);
 
+    bool complete = true;
+
 #if 1
     {
       std::vector<std::string> resources2, instances2;
 
+      size_t lookupLimit = (limit == 0 ? 0 : limit + 1);
+      
       if (lookup.GetLevel() == ResourceType_Patient)
       {
-        GetIndex().ApplyLookupPatients(resources2, instances2, lookup2, limit /* TODO */);
+        GetIndex().ApplyLookupPatients(resources2, instances2, lookup2, lookupLimit);
       }
       else
       {
-        GetIndex().ApplyLookupResources(resources2, instances2, lookup2, lookup.GetLevel(), limit /* TODO */);
+        GetIndex().ApplyLookupResources(resources2, instances2, lookup2,
+                                        lookup.GetLevel(), lookupLimit);
       }
 
+      if (limit != 0 &&
+          resources2.size() > limit)
+      {
+        complete = false;
+      }
+      
+      // Sanity checks
       std::set<std::string> r;
       for (size_t i = 0; i < resources2.size(); i++)
       {
@@ -845,7 +857,6 @@
 
     size_t countResults = 0;
     size_t skipped = 0;
-    bool complete = true;
 
     const bool isDicomAsJsonNeeded = visitor.IsDicomAsJsonNeeded();