diff OrthancServer/Search/RangeConstraint.cpp @ 2697:e583478e0c6c jobs

New primitive in database SDK: "lookupIdentifierRange" to speed up range searches
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 03 Jul 2018 15:59:17 +0200
parents 878b59270859
children 8fd203510d8b 4e43e67f8ecf
line wrap: on
line diff
--- a/OrthancServer/Search/RangeConstraint.cpp	Tue Jul 03 15:07:41 2018 +0200
+++ b/OrthancServer/Search/RangeConstraint.cpp	Tue Jul 03 15:59:17 2018 +0200
@@ -59,14 +59,22 @@
   void RangeConstraint::Setup(LookupIdentifierQuery& lookup,
                               const DicomTag& tag) const
   {
-    if (!lower_.empty())
+    if (!lower_.empty() &&
+        !upper_.empty())
     {
-      lookup.AddConstraint(tag, IdentifierConstraintType_GreaterOrEqual, lower_);
+      lookup.AddRange(tag, lower_, upper_);
     }
+    else
+    {
+      if (!lower_.empty())
+      {
+        lookup.AddConstraint(tag, IdentifierConstraintType_GreaterOrEqual, lower_);
+      }
 
-    if (!upper_.empty())
-    {
-      lookup.AddConstraint(tag, IdentifierConstraintType_SmallerOrEqual, upper_);
+      if (!upper_.empty())
+      {
+        lookup.AddConstraint(tag, IdentifierConstraintType_SmallerOrEqual, upper_);
+      }
     }
   }