Skip to content

Commit

Permalink
fix(server): kneigbor-api has unmatched edge type with server (#2699)
Browse files Browse the repository at this point in the history
Co-authored-by: lijie0203 <[email protected]>
Co-authored-by: imbajin <[email protected]>
  • Loading branch information
3 people authored Dec 20, 2024
1 parent f838897 commit a369ef1
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 a369ef1

Please sign in to comment.