diff OrthancServer/Search/RangeConstraint.cpp @ 1887:5e0a25642056

Fix range search if the lower or upper limit is absent
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 11 Dec 2015 15:59:05 +0100
parents 03b030680e3d
children b1291df2f780
line wrap: on
line diff
--- a/OrthancServer/Search/RangeConstraint.cpp	Fri Dec 11 15:43:33 2015 +0100
+++ b/OrthancServer/Search/RangeConstraint.cpp	Fri Dec 11 15:59:05 2015 +0100
@@ -55,8 +55,15 @@
   void RangeConstraint::Setup(LookupIdentifierQuery& lookup,
                               const DicomTag& tag) const
   {
-    lookup.AddConstraint(tag, IdentifierConstraintType_GreaterOrEqual, lower_);
-    lookup.AddConstraint(tag, IdentifierConstraintType_SmallerOrEqual, upper_);
+    if (!lower_.empty())
+    {
+      lookup.AddConstraint(tag, IdentifierConstraintType_GreaterOrEqual, lower_);
+    }
+
+    if (!upper_.empty())
+    {
+      lookup.AddConstraint(tag, IdentifierConstraintType_SmallerOrEqual, upper_);
+    }
   }