diff OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 5684:9b3816c21008 find-refactoring

integration mainline->find-refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Jul 2024 11:39:07 +0200
parents dc96401dbe88 0c218d90096e
children d0a264b803f1
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Tue Jul 09 11:17:34 2024 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp	Tue Jul 09 11:39:07 2024 +0200
@@ -3502,6 +3502,8 @@
         }
       }
 
+      std::set<std::string> labels;
+
       if (request.isMember(KEY_LABELS))  // New in Orthanc 1.12.0
       {
         for (Json::Value::ArrayIndex i = 0; i < request[KEY_LABELS].size(); i++)
@@ -3512,27 +3514,27 @@
           }
           else
           {
-            query.AddLabel(request[KEY_LABELS][i].asString());
+            labels.insert(request[KEY_LABELS][i].asString());
           }
         }
       }
 
-      query.SetLabelsConstraint(LabelsConstraint_All);
+      LabelsConstraint labelsConstraint = LabelsConstraint_All;
       
       if (request.isMember(KEY_LABELS_CONSTRAINT))
       {
         const std::string& s = request[KEY_LABELS_CONSTRAINT].asString();
         if (s == "All")
         {
-          query.SetLabelsConstraint(LabelsConstraint_All);
+          labelsConstraint = LabelsConstraint_All;
         }
         else if (s == "Any")
         {
-          query.SetLabelsConstraint(LabelsConstraint_Any);
+          labelsConstraint = LabelsConstraint_Any;
         }
         else if (s == "None")
         {
-          query.SetLabelsConstraint(LabelsConstraint_None);
+          labelsConstraint = LabelsConstraint_None;
         }
         else
         {
@@ -3541,7 +3543,7 @@
       }
       
       FindVisitor visitor(OrthancRestApi::GetDicomFormat(request, DicomToJsonFormat_Human), context.GetFindStorageAccessMode());
-      context.Apply(visitor, query, level, since, limit);
+      context.Apply(visitor, query, level, labels, labelsConstraint, since, limit);
       visitor.Answer(call.GetOutput(), context, level, expand, requestedTags);
     }
   }