mirror of https://gitee.com/bigwinds/arangodb
Fixed single server version of Traverser
This commit is contained in:
parent
a2ecc653f0
commit
8e678d0fc2
|
@ -90,15 +90,8 @@ TraversalBlock::TraversalBlock(ExecutionEngine* engine, TraversalNode const* ep)
|
|||
std::string(_trx->vocbase()->_name, strlen(_trx->vocbase()->_name)),
|
||||
_resolver, _expressions));
|
||||
} else {
|
||||
std::vector<TRI_document_collection_t*> edgeCollections;
|
||||
for (auto const& coll : ep->edgeColls()) {
|
||||
TRI_voc_cid_t cid = _resolver->getCollectionIdLocal(coll);
|
||||
edgeCollections.push_back(_trx->documentCollection(cid));
|
||||
|
||||
_trx->orderDitch(cid);
|
||||
}
|
||||
_traverser.reset(new arangodb::traverser::DepthFirstTraverser(
|
||||
edgeCollections, opts, _trx, _expressions));
|
||||
_traverser.reset(
|
||||
new arangodb::traverser::DepthFirstTraverser(opts, _trx, _expressions));
|
||||
}
|
||||
if (!ep->usesInVariable()) {
|
||||
_vertexId = ep->getStartVertex();
|
||||
|
|
|
@ -819,14 +819,10 @@ void SingleServerTraversalPath::lastVertexToVelocyPack(Transaction* trx, VPackBu
|
|||
}
|
||||
|
||||
DepthFirstTraverser::DepthFirstTraverser(
|
||||
std::vector<TRI_document_collection_t*> const& edgeCollections,
|
||||
TraverserOptions& opts, Transaction* trx,
|
||||
std::unordered_map<size_t, std::vector<TraverserExpression*>> const*
|
||||
expressions)
|
||||
: Traverser(opts, expressions),
|
||||
_edgeGetter(this, opts, trx),
|
||||
_edgeCols(edgeCollections),
|
||||
_trx(trx) {
|
||||
: Traverser(opts, expressions), _edgeGetter(this, opts, trx), _trx(trx) {
|
||||
_defInternalFunctions();
|
||||
}
|
||||
|
||||
|
@ -892,22 +888,17 @@ bool DepthFirstTraverser::vertexMatchesConditions(std::string const& v,
|
|||
}
|
||||
|
||||
void DepthFirstTraverser::_defInternalFunctions() {
|
||||
_getVertex = [](std::string const& edge, std::string const& vertex, size_t depth,
|
||||
_getVertex = [this](std::string const& edge, std::string const& vertex, size_t depth,
|
||||
std::string& result) -> bool {
|
||||
return false;
|
||||
// TODO FIX THIS
|
||||
/* Do we still use mptr here or do we switch to VPack?
|
||||
auto mptr = edge.mptr;
|
||||
if (strcmp(TRI_EXTRACT_MARKER_FROM_KEY(&mptr), vertex.key) == 0 &&
|
||||
TRI_EXTRACT_MARKER_FROM_CID(&mptr) == vertex.cid) {
|
||||
result = VertexId(TRI_EXTRACT_MARKER_TO_CID(&mptr),
|
||||
TRI_EXTRACT_MARKER_TO_KEY(&mptr));
|
||||
} else {
|
||||
result = VertexId(TRI_EXTRACT_MARKER_FROM_CID(&mptr),
|
||||
TRI_EXTRACT_MARKER_FROM_KEY(&mptr));
|
||||
auto const& it = _edges.find(edge);
|
||||
TRI_ASSERT(it != _edges.end());
|
||||
VPackSlice v(it->second->data());
|
||||
// NOTE: We assume that we only have valid edges.
|
||||
result = v.get(TRI_VOC_ATTRIBUTE_FROM).copyString();
|
||||
if (result == vertex) {
|
||||
result = v.get(TRI_VOC_ATTRIBUTE_TO).copyString();
|
||||
}
|
||||
return true;
|
||||
*/
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -333,8 +333,7 @@ class DepthFirstTraverser : public Traverser {
|
|||
|
||||
public:
|
||||
DepthFirstTraverser(
|
||||
std::vector<TRI_document_collection_t*> const&, TraverserOptions&,
|
||||
Transaction*,
|
||||
TraverserOptions&, Transaction*,
|
||||
std::unordered_map<size_t, std::vector<TraverserExpression*>> const*);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -118,8 +118,8 @@ bool arangodb::traverser::TraverserOptions::getCollectionAndSearchValue(
|
|||
name = _collections.at(index);
|
||||
indexHandle = _indexHandles.at(index);
|
||||
|
||||
_builder.clear();
|
||||
arangodb::EdgeIndex::buildSearchValue(dir, name, _builder);
|
||||
builder.clear();
|
||||
arangodb::EdgeIndex::buildSearchValue(dir, vertexId, builder);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue