diff OrthancServer/ServerIndex.cpp @ 3031:18a2d196414b db-changes

simplification
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Dec 2018 13:08:04 +0100
parents 25afa7b8cb51
children 5da6d1063d8f
line wrap: on
line diff
--- a/OrthancServer/ServerIndex.cpp	Wed Dec 19 11:18:39 2018 +0100
+++ b/OrthancServer/ServerIndex.cpp	Wed Dec 19 13:08:04 2018 +0100
@@ -2565,56 +2565,31 @@
 
     target.clear();
     target.reserve(source.GetConstraintsCount());
-    
+
     for (size_t i = 0; i < source.GetConstraintsCount(); i++)
     {
-      const DicomTagConstraint& constraint = source.GetConstraint(i);
+      ResourceType level;
+      DicomTagType type;
       
-      ResourceType tagLevel;
-      DicomTagType tagType;
-      mainDicomTagsRegistry_->LookupTag(tagLevel, tagType, constraint.GetTag());
-
-      if (//IsResourceLevelAboveOrEqual(tagLevel, queryLevel) &&
-          (tagType == DicomTagType_Identifier ||
-           tagType == DicomTagType_Main))
+      mainDicomTagsRegistry_->LookupTag(level, type, source.GetConstraint(i).GetTag());
+
+      if (type == DicomTagType_Identifier ||
+          type == DicomTagType_Main)
       {
         // Use the fact that patient-level tags are copied at the study level
-        if (queryLevel != ResourceType_Patient &&
-            tagLevel == ResourceType_Patient)
+        if (level == ResourceType_Patient &&
+            queryLevel != ResourceType_Patient)
         {
-          tagLevel = ResourceType_Study;
+          level = ResourceType_Study;
         }
         
-        DatabaseConstraint c(constraint, tagLevel, tagType);
-
-        // Avoid universal constraints
-        if (!(c.GetConstraintType() == ConstraintType_Equal &&
-              c.GetSingleValue() == "") &&
-            !(c.GetConstraintType() == ConstraintType_Wildcard &&
-              c.GetSingleValue() == "*"))
-        {
-          target.push_back(c);
-        }
+        DatabaseConstraint c(source.GetConstraint(i), level, type);
+        target.push_back(c);
       }
     }
   }
 
 
-  void ServerIndex::ApplyLookupPatients(std::vector<std::string>& patientsId,
-                                        std::vector<std::string>& instancesId,
-                                        const DatabaseLookup& lookup,
-                                        size_t limit)
-  {
-    std::vector<DatabaseConstraint> normalized;
-    NormalizeLookup(normalized, lookup, ResourceType_Patient);
-
-    {
-      boost::mutex::scoped_lock lock(mutex_);
-      db_.ApplyLookupPatients(patientsId, instancesId, normalized, limit);
-    }
-  }
-
-  
   void ServerIndex::ApplyLookupResources(std::vector<std::string>& resourcesId,
                                          std::vector<std::string>& instancesId,
                                          const DatabaseLookup& lookup,