Skip to content

Commit

Permalink
fix(server): kneigbor-api has unmatched edge type with server
Browse files Browse the repository at this point in the history
  • Loading branch information
lijie0203 committed Nov 27, 2024
1 parent d142d91 commit a22320e
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.apache.hugegraph.util.E;
import org.apache.hugegraph.util.Log;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.slf4j.Logger;

import com.codahale.metrics.annotation.Timed;
Expand Down Expand Up @@ -169,7 +170,7 @@ public String post(@Context GraphManager manager,
QueryResults.emptyIterator());
}

Iterator<?> iterVertex;
Iterator<Vertex> iterVertex = Collections.emptyIterator();
Set<Id> vertexIds = new HashSet<>(neighbors);
if (request.withPath) {
for (HugeTraverser.Path p : paths) {
Expand All @@ -179,18 +180,12 @@ public String post(@Context GraphManager manager,
if (request.withVertex && !vertexIds.isEmpty()) {
iterVertex = g.vertices(vertexIds.toArray());
measure.addIterCount(vertexIds.size(), 0L);
} else {
iterVertex = vertexIds.iterator();
}

Iterator<?> iterEdge = Collections.emptyIterator();
if (request.withPath) {
Iterator<Edge> iterEdge = Collections.emptyIterator();
if (request.withPath && request.withEdge) {
Set<Edge> edges = results.edgeResults().getEdges(paths);
if (request.withEdge) {
iterEdge = edges.iterator();
} else {
iterEdge = HugeTraverser.EdgeRecord.getEdgeIds(edges).iterator();
}
iterEdge = edges.iterator();
}

return manager.serializer(g, measure.measures())
Expand Down

0 comments on commit a22320e

Please sign in to comment.