This is an automated email from the ASF dual-hosted git repository.

jin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git


The following commit(s) were added to refs/heads/master by this push:
     new c997f35b0 fix(api): correct the vertex id in the edge-existence api 
(#2380)
c997f35b0 is described below

commit c997f35b0475e94a98748dda636cb9bfa78fda77
Author: M <[email protected]>
AuthorDate: Fri Dec 8 15:59:28 2023 +0800

    fix(api): correct the vertex id in the edge-existence api (#2380)
---
 .../java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java | 5 +++--
 .../hugegraph/traversal/algorithm/EdgeExistenceTraverser.java      | 7 +++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
 
b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
index 6ffec166e..4af3ff52f 100644
--- 
a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
+++ 
b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/traversers/EdgeExistenceAPI.java
@@ -22,6 +22,7 @@ import static 
org.apache.hugegraph.traversal.algorithm.HugeTraverser.DEFAULT_LIM
 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;
@@ -72,8 +73,8 @@ public class EdgeExistenceAPI extends TraverserAPI {
         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,
diff --git 
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java
 
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java
index a7005ad86..38f92daa3 100644
--- 
a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java
+++ 
b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/EdgeExistenceTraverser.java
@@ -42,16 +42,15 @@ public class EdgeExistenceTraverser extends HugeTraverser {
             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, "");

Reply via email to