Mercurial > hg > orthanc
changeset 3163:cf91b6f22278
Fix issue #90 (C-Find shall match missing tags to null/empty string)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Jan 2019 18:04:55 +0100 |
parents | 94a4f75cc746 |
children | b79ec21747a1 |
files | NEWS OrthancServer/OrthancFindRequestHandler.cpp OrthancServer/OrthancRestApi/OrthancRestResources.cpp OrthancServer/Search/DatabaseLookup.h |
diffstat | 4 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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; }
--- 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;
--- 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,