From 5dce6b512ffadb4dafcd717ea047f3d4db561c4e Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Mon, 7 Dec 2015 14:23:05 +0100 Subject: [PATCH] Added a helper to build an index from VelocyPack description --- arangod/VocBase/document-collection.cpp | 12 ++++++++++++ arangod/VocBase/document-collection.h | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/arangod/VocBase/document-collection.cpp b/arangod/VocBase/document-collection.cpp index a9b88f8eed..693f4441b0 100644 --- a/arangod/VocBase/document-collection.cpp +++ b/arangod/VocBase/document-collection.cpp @@ -2662,6 +2662,18 @@ size_t TRI_DocumentIteratorDocumentCollection (triagens::arango::Transaction* tr return nrUsed; } +//////////////////////////////////////////////////////////////////////////////// +/// @brief create an index, based on a VelocyPack description +//////////////////////////////////////////////////////////////////////////////// + +int TRI_FromVelocyPackIndexDocumentCollection (triagens::arango::Transaction* trx, + TRI_document_collection_t* document, + VPackSlice const& slice, + triagens::arango::Index** idx) { + std::unique_ptr json(triagens::basics::VelocyPackHelper::velocyPackToJson(slice)); + return TRI_FromJsonIndexDocumentCollection(trx, document, json.get(), idx); +} + //////////////////////////////////////////////////////////////////////////////// /// @brief create an index, based on a JSON description //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/VocBase/document-collection.h b/arangod/VocBase/document-collection.h index f0178cdfb6..8e1c51a7de 100644 --- a/arangod/VocBase/document-collection.h +++ b/arangod/VocBase/document-collection.h @@ -790,6 +790,15 @@ void TRI_UpdateRevisionDocumentCollection (TRI_document_collection_t*, bool TRI_IsFullyCollectedDocumentCollection (TRI_document_collection_t*); +//////////////////////////////////////////////////////////////////////////////// +/// @brief create an index, based on a VelocyPack description +//////////////////////////////////////////////////////////////////////////////// + +int TRI_FromVelocyPackIndexDocumentCollection (triagens::arango::Transaction*, + TRI_document_collection_t*, + VPackSlice const&, + triagens::arango::Index**); + //////////////////////////////////////////////////////////////////////////////// /// @brief create an index, based on a JSON description ////////////////////////////////////////////////////////////////////////////////