changeset 1754:3a4f7dc00f49 db-changes

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 28 Oct 2015 11:31:58 +0100
parents faf2ecab3472
children 39c37a994b2f
files OrthancServer/Search/ListConstraint.cpp OrthancServer/Search/LookupResource.cpp OrthancServer/Search/RangeConstraint.cpp OrthancServer/Search/ValueConstraint.cpp OrthancServer/ServerIndex.cpp
diffstat 5 files changed, 24 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Search/ListConstraint.cpp	Tue Oct 27 20:31:34 2015 +0100
+++ b/OrthancServer/Search/ListConstraint.cpp	Wed Oct 28 11:31:58 2015 +0100
@@ -40,14 +40,14 @@
   {
     if (isCaseSensitive_)
     {
+      allowedValues_.insert(value);
+    }
+    else
+    {
       std::string s = value;
       Toolbox::ToUpperCase(s);
       allowedValues_.insert(s);      
     }
-    else
-    {
-      allowedValues_.insert(value);
-    }
   }
 
 
@@ -67,7 +67,7 @@
   {
     std::string v = value;
 
-    if (isCaseSensitive_)
+    if (!isCaseSensitive_)
     {
       Toolbox::ToUpperCase(v);
     }
--- a/OrthancServer/Search/LookupResource.cpp	Tue Oct 27 20:31:34 2015 +0100
+++ b/OrthancServer/Search/LookupResource.cpp	Wed Oct 28 11:31:58 2015 +0100
@@ -315,7 +315,17 @@
   void LookupResource::FindCandidates(std::list<int64_t>& result,
                                       IDatabaseWrapper& database) const
   {
-    SetOfResources candidates(database, level_);
+    ResourceType startingLevel;
+    if (level_ == ResourceType_Patient)
+    {
+      startingLevel = ResourceType_Patient;
+    }
+    else
+    {
+      startingLevel = ResourceType_Study;
+    }
+
+    SetOfResources candidates(database, startingLevel);
 
     switch (level_)
     {
--- a/OrthancServer/Search/RangeConstraint.cpp	Tue Oct 27 20:31:34 2015 +0100
+++ b/OrthancServer/Search/RangeConstraint.cpp	Wed Oct 28 11:31:58 2015 +0100
@@ -46,7 +46,7 @@
     upper_(upper),
     isCaseSensitive_(isCaseSensitive)
   {
-    if (isCaseSensitive_)
+    if (!isCaseSensitive_)
     {
       Toolbox::ToUpperCase(lower_);
       Toolbox::ToUpperCase(upper_);
@@ -65,7 +65,7 @@
   {
     std::string v = value;
 
-    if (isCaseSensitive_)
+    if (!isCaseSensitive_)
     {
       Toolbox::ToUpperCase(v);
     }
--- a/OrthancServer/Search/ValueConstraint.cpp	Tue Oct 27 20:31:34 2015 +0100
+++ b/OrthancServer/Search/ValueConstraint.cpp	Wed Oct 28 11:31:58 2015 +0100
@@ -35,6 +35,8 @@
 
 #include "../../Core/Toolbox.h"
 
+#include <stdio.h>
+
 namespace Orthanc
 {
   ValueConstraint::ValueConstraint(const DicomTag& tag, 
@@ -44,7 +46,7 @@
     value_(value),
     isCaseSensitive_(isCaseSensitive)
   {
-    if (isCaseSensitive)
+    if (!isCaseSensitive)
     {
       Toolbox::ToUpperCase(value_);
     }
@@ -65,7 +67,7 @@
     else
     {
       std::string v;
-      Toolbox::ToLowerCase(v, value);
+      Toolbox::ToUpperCase(v, value);
       return value_ == v;
     }
   }
--- a/OrthancServer/ServerIndex.cpp	Tue Oct 27 20:31:34 2015 +0100
+++ b/OrthancServer/ServerIndex.cpp	Wed Oct 28 11:31:58 2015 +0100
@@ -2131,6 +2131,8 @@
     for (std::list<int64_t>::const_iterator
            it = tmp.begin(); it != tmp.end(); ++it, pos++)
     {
+      assert(db_.GetResourceType(*it) == lookup.GetLevel());
+      
       int64_t instance;
       if (!Toolbox::FindOneChildInstance(instance, db_, *it, lookup.GetLevel()))
       {