# HG changeset patch # User Alain Mazy # Date 1726221434 -7200 # Node ID de33982a0bf4c3bc545dac6b77f5041221d7af94 # Parent 9af45c841f59862697725a3814cae7083bc78d37 wip: started implementing Find in PostgreSQL diff -r 9af45c841f59 -r de33982a0bf4 OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp --- a/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp Thu Sep 12 10:03:17 2024 +0200 +++ b/OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.cpp Fri Sep 13 11:57:14 2024 +0200 @@ -1577,8 +1577,6 @@ response.Add(target.release()); } - - throw OrthancException(ErrorCode_NotImplemented); } else { diff -r 9af45c841f59 -r de33982a0bf4 OrthancServer/Sources/Database/FindRequest.cpp --- a/OrthancServer/Sources/Database/FindRequest.cpp Thu Sep 12 10:03:17 2024 +0200 +++ b/OrthancServer/Sources/Database/FindRequest.cpp Fri Sep 13 11:57:14 2024 +0200 @@ -261,13 +261,6 @@ bool FindRequest::IsRetrieveOneInstanceMetadataAndAttachments() const { - if (level_ == ResourceType_Instance) - { - throw OrthancException(ErrorCode_BadSequenceOfCalls); - } - else - { - return retrieveOneInstanceMetadataAndAttachments_; - } + return retrieveOneInstanceMetadataAndAttachments_; } } diff -r 9af45c841f59 -r de33982a0bf4 OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp --- a/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Thu Sep 12 10:03:17 2024 +0200 +++ b/OrthancServer/Sources/Database/SQLiteDatabaseWrapper.cpp Fri Sep 13 11:57:14 2024 +0200 @@ -1806,6 +1806,7 @@ dbCapabilities_.SetFlushToDisk(true); dbCapabilities_.SetLabelsSupport(true); dbCapabilities_.SetHasExtendedChanges(true); + dbCapabilities_.SetHasFindSupport(true); db_.Open(path); } @@ -1819,6 +1820,7 @@ dbCapabilities_.SetFlushToDisk(true); dbCapabilities_.SetLabelsSupport(true); dbCapabilities_.SetHasExtendedChanges(true); + dbCapabilities_.SetHasFindSupport(true); db_.OpenInMemory(); } diff -r 9af45c841f59 -r de33982a0bf4 OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Thu Sep 12 10:03:17 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.cpp Fri Sep 13 11:57:14 2024 +0200 @@ -3716,6 +3716,12 @@ return db_.GetDatabaseCapabilities().HasExtendedChanges(); } + bool StatelessDatabaseOperations::HasFindSupport() + { + boost::shared_lock lock(mutex_); + return db_.GetDatabaseCapabilities().HasFindSupport(); + } + void StatelessDatabaseOperations::ExecuteFind(FindResponse& response, const FindRequest& request) { diff -r 9af45c841f59 -r de33982a0bf4 OrthancServer/Sources/Database/StatelessDatabaseOperations.h --- a/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Thu Sep 12 10:03:17 2024 +0200 +++ b/OrthancServer/Sources/Database/StatelessDatabaseOperations.h Fri Sep 13 11:57:14 2024 +0200 @@ -679,6 +679,8 @@ bool HasExtendedChanges(); + bool HasFindSupport(); + void GetExportedResources(Json::Value& target, int64_t since, uint32_t limit); diff -r 9af45c841f59 -r de33982a0bf4 OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Thu Sep 12 10:03:17 2024 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp Fri Sep 13 11:57:14 2024 +0200 @@ -94,6 +94,7 @@ static const char* const HAS_LABELS = "HasLabels"; static const char* const CAPABILITIES = "Capabilities"; static const char* const HAS_EXTENDED_CHANGES = "HasExtendedChanges"; + static const char* const HAS_EXTENDED_FIND = "HasExtendedFind"; if (call.IsDocumentation()) { @@ -141,7 +142,7 @@ .SetAnswerField(HAS_LABELS, RestApiCallDocumentation::Type_Boolean, "Whether the database back-end supports labels (new in Orthanc 1.12.0)") .SetAnswerField(CAPABILITIES, RestApiCallDocumentation::Type_JsonObject, - "Whether the back-end supports optional features like 'HasExtendedChanges' (new in Orthanc 1.12.5) ") + "Whether the back-end supports optional features like 'HasExtendedChanges', 'HasExtendedFind' (new in Orthanc 1.12.5) ") .SetHttpGetSample("https://orthanc.uclouvain.be/demo/system", true); return; } @@ -202,6 +203,7 @@ result[HAS_LABELS] = OrthancRestApi::GetIndex(call).HasLabelsSupport(); result[CAPABILITIES] = Json::objectValue; result[CAPABILITIES][HAS_EXTENDED_CHANGES] = OrthancRestApi::GetIndex(call).HasExtendedChanges(); + result[CAPABILITIES][HAS_EXTENDED_FIND] = OrthancRestApi::GetIndex(call).HasFindSupport(); call.GetOutput().AnswerJson(result); }