changeset 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 5be57564ffc4
children 512b6e76f531
files NEWS OrthancServer/Search/RangeConstraint.cpp
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Fri Dec 11 15:43:33 2015 +0100
+++ b/NEWS	Fri Dec 11 15:59:05 2015 +0100
@@ -3,6 +3,7 @@
 
 * Fix of DICOMDIR generation with DCMTK 3.6.1, support of encodings
 * New function in plugin SDK: "OrthancPluginSendMultipartItem2()"
+* Fix range search if the lower or upper limit is absent
 
 
 Version 0.9.6 (2015/12/08)
--- 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_);
+    }
   }