Skip to content

Commit

Permalink
fix(api): correct the vertex id in the edge-existence api (#2380)
Browse files Browse the repository at this point in the history
  • Loading branch information
msgui authored Dec 8, 2023
1 parent 47aa8be commit c997f35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Iterator;

import org.apache.hugegraph.HugeGraph;
import org.apache.hugegraph.api.graph.VertexAPI;
import org.apache.hugegraph.backend.id.Id;
import org.apache.hugegraph.core.GraphManager;
import org.apache.hugegraph.structure.HugeVertex;
Expand Down Expand Up @@ -72,8 +73,8 @@ public String get(@Context GraphManager manager,
E.checkArgumentNotNull(source, "The source can't be null");
E.checkArgumentNotNull(target, "The target can't be null");

Id sourceId = HugeVertex.getIdValue(source);
Id targetId = HugeVertex.getIdValue(target);
Id sourceId = VertexAPI.checkAndParseVertexId(source);
Id targetId = VertexAPI.checkAndParseVertexId(target);
HugeGraph hugegraph = graph(manager, graph);
EdgeExistenceTraverser traverser = new EdgeExistenceTraverser(hugegraph);
Iterator<Edge> edges = traverser.queryEdgeExistence(sourceId, targetId, edgeLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@ public Iterator<Edge> queryEdgeExistence(Id sourceId, Id targetId, String label,
return queryByNeighbors(sourceId, targetId, limit);
}

Id edgeLabelId = getEdgeLabelId(label);
EdgeLabel edgeLabel = graph().edgeLabel(edgeLabelId);
EdgeLabel edgeLabel = graph().edgeLabel(label);
ConditionQuery conditionQuery = new ConditionQuery(HugeType.EDGE);
conditionQuery.eq(HugeKeys.OWNER_VERTEX, sourceId);
conditionQuery.eq(HugeKeys.OTHER_VERTEX, targetId);
conditionQuery.eq(HugeKeys.LABEL, edgeLabelId);
conditionQuery.eq(HugeKeys.LABEL, edgeLabel.id());
conditionQuery.eq(HugeKeys.DIRECTION, Directions.OUT);
conditionQuery.limit(limit);

if (edgeLabel.existSortKeys()) {
if (edgeLabel.existSortKeys() && !sortValues.isEmpty()) {
conditionQuery.eq(HugeKeys.SORT_VALUES, sortValues);
} else {
conditionQuery.eq(HugeKeys.SORT_VALUES, "");
Expand Down

0 comments on commit c997f35

Please sign in to comment.