# HG changeset patch # User Sebastien Jodogne # Date 1548349495 -3600 # Node ID cf91b6f222784a9664961569f76ace9d47d52231 # Parent 94a4f75cc74615b4c324eb6d3ff56b44b06c2cf2 Fix issue #90 (C-Find shall match missing tags to null/empty string) diff -r 94a4f75cc746 -r cf91b6f22278 NEWS --- a/NEWS Thu Jan 24 16:47:05 2019 +0100 +++ b/NEWS Thu Jan 24 18:04:55 2019 +0100 @@ -3,6 +3,7 @@ * Don't return tags whose group is below 0x0008 in C-FIND SCP answers * Fix compatibility with DICOMweb plugin (allow multipart answers over HTTP Keep-Alive) +* Fix issue #90 (C-Find shall match missing tags to null/empty string) * Fix issue #119 (/patients/.../archive returns a 500 when JobsHistorySize is 0) * Fix issue #128 (Asynchronous C-MOVE: invalid number of remaining sub-operations) diff -r 94a4f75cc746 -r cf91b6f22278 OrthancServer/OrthancFindRequestHandler.cpp --- a/OrthancServer/OrthancFindRequestHandler.cpp Thu Jan 24 16:47:05 2019 +0100 +++ b/OrthancServer/OrthancFindRequestHandler.cpp Thu Jan 24 18:04:55 2019 +0100 @@ -639,7 +639,7 @@ std::string value = element.GetValue().GetContent(); if (value.size() == 0) { - // An empty string corresponds to a "*" wildcard constraint, so we ignore it + // An empty string corresponds to an universal constraint, so we ignore it continue; } diff -r 94a4f75cc746 -r cf91b6f22278 OrthancServer/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Thu Jan 24 16:47:05 2019 +0100 +++ b/OrthancServer/OrthancRestApi/OrthancRestResources.cpp Thu Jan 24 18:04:55 2019 +0100 @@ -1415,9 +1415,16 @@ "Tag \"" + members[i] + "\" should be associated with a string"); } - query.AddRestConstraint(FromDcmtkBridge::ParseTag(members[i]), - request[KEY_QUERY][members[i]].asString(), - caseSensitive, true); + const std::string value = request[KEY_QUERY][members[i]].asString(); + + if (!value.empty()) + { + // An empty string corresponds to an universal constraint, + // so we ignore it. This mimics the behavior of class + // "OrthancFindRequestHandler" + query.AddRestConstraint(FromDcmtkBridge::ParseTag(members[i]), + value, caseSensitive, true); + } } FindVisitor visitor; diff -r 94a4f75cc746 -r cf91b6f22278 OrthancServer/Search/DatabaseLookup.h --- a/OrthancServer/Search/DatabaseLookup.h Thu Jan 24 16:47:05 2019 +0100 +++ b/OrthancServer/Search/DatabaseLookup.h Thu Jan 24 18:04:55 2019 +0100 @@ -49,6 +49,9 @@ const std::string& dicomQuery, bool caseSensitive, bool mandatoryTag); + + void AddConstraint(DicomTagConstraint* constraint); // Takes ownership + public: DatabaseLookup() { @@ -68,8 +71,6 @@ const DicomTagConstraint& GetConstraint(size_t index) const; - void AddConstraint(DicomTagConstraint* constraint); // Takes ownership - bool IsMatch(const DicomMap& value) const; bool IsMatch(DcmItem& item,