comparison OrthancServer/OrthancRestApi/OrthancRestResources.cpp @ 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 61da3c9b4121
children 8ea7c4546c3a
comparison
equal deleted inserted replaced
3162:94a4f75cc746 3163:cf91b6f22278
1413 { 1413 {
1414 throw OrthancException(ErrorCode_BadRequest, 1414 throw OrthancException(ErrorCode_BadRequest,
1415 "Tag \"" + members[i] + "\" should be associated with a string"); 1415 "Tag \"" + members[i] + "\" should be associated with a string");
1416 } 1416 }
1417 1417
1418 query.AddRestConstraint(FromDcmtkBridge::ParseTag(members[i]), 1418 const std::string value = request[KEY_QUERY][members[i]].asString();
1419 request[KEY_QUERY][members[i]].asString(), 1419
1420 caseSensitive, true); 1420 if (!value.empty())
1421 {
1422 // An empty string corresponds to an universal constraint,
1423 // so we ignore it. This mimics the behavior of class
1424 // "OrthancFindRequestHandler"
1425 query.AddRestConstraint(FromDcmtkBridge::ParseTag(members[i]),
1426 value, caseSensitive, true);
1427 }
1421 } 1428 }
1422 1429
1423 FindVisitor visitor; 1430 FindVisitor visitor;
1424 context.Apply(visitor, query, level, since, limit); 1431 context.Apply(visitor, query, level, since, limit);
1425 visitor.Answer(call.GetOutput(), context.GetIndex(), level, expand); 1432 visitor.Answer(call.GetOutput(), context.GetIndex(), level, expand);