diff --git a/arangod/Aql/ExecutionNode.cpp b/arangod/Aql/ExecutionNode.cpp index 59e26f0122..3158565e5f 100644 --- a/arangod/Aql/ExecutionNode.cpp +++ b/arangod/Aql/ExecutionNode.cpp @@ -397,6 +397,44 @@ void EnumerateCollectionNode::toJsonHelper (triagens::basics::Json& nodes, nodes(json); } +//////////////////////////////////////////////////////////////////////////////// +/// @brief get vector of indexes with fields +//////////////////////////////////////////////////////////////////////////////// + +std::vector EnumerateCollectionNode::getIndexes (vector attrs) const { + std::vector out; + TRI_document_collection_t* document = _collection->documentCollection(); + size_t const n = document->_allIndexes._length; + + for (size_t i = 0; i < n; ++i) { + TRI_index_t* idx = static_cast(document->_allIndexes._buffer[i]); + + size_t seen = 0; + for (size_t j = 0; j < idx->_fields._length; j++) { + bool found = false; + for (size_t k = 0; k < attrs.size(); k++){ + if(std::string(idx->_fields._buffer[j]) == attrs[k]) { + found = true; + break; + } + } + if (found) { + seen++; + } + else { + break; + } + } + + if (((idx->_type == TRI_IDX_TYPE_HASH_INDEX) && seen == idx->_fields._length ) + || ((idx->_type == TRI_IDX_TYPE_SKIPLIST_INDEX) && seen > 0 )) { + // all fields equal + out.push_back(idx); + } + } + return out; +} + // ----------------------------------------------------------------------------- // --SECTION-- methods of EnumerateListNode // ----------------------------------------------------------------------------- diff --git a/arangod/Aql/ExecutionNode.h b/arangod/Aql/ExecutionNode.h index c0d2705ffc..add69bc6ff 100644 --- a/arangod/Aql/ExecutionNode.h +++ b/arangod/Aql/ExecutionNode.h @@ -658,39 +658,7 @@ namespace triagens { /// @brief get vector of indexes with fields //////////////////////////////////////////////////////////////////////////////// - vector getIndexes (vector attrs) const { - vector out; - TRI_document_collection_t* document = _collection->documentCollection(); - size_t const n = document->_allIndexes._length; - - for (size_t i = 0; i < n; ++i) { - TRI_index_t* idx = static_cast(document->_allIndexes._buffer[i]); - - size_t seen = 0; - for (size_t j = 0; j < idx->_fields._length; j++) { - bool found = false; - for (size_t k = 0; k < attrs.size(); k++){ - if(std::string(idx->_fields._buffer[j]) == attrs[k]) { - found = true; - break; - } - } - if (found) { - seen++; - } - else { - break; - } - } - - if (((idx->_type == TRI_IDX_TYPE_HASH_INDEX) && seen == idx->_fields._length ) - || ((idx->_type == TRI_IDX_TYPE_SKIPLIST_INDEX) && seen > 0 )) { - // all fields equal - out.push_back(idx); - } - } - return out; - } + std::vector getIndexes (vector attrs) const; TRI_vocbase_t* vocbase () const { return _vocbase;