[Improvement] HugeGraph could not search for string values using between() API
- Dominant language
- Java
- Stars
- 3.2k
- Forks
- 636
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 14
Description
### Bug Type (问题类型)
gremlin (结果不合预期)
### Before submit
- [X] 我已经确认现有的 [Issues](https://github.com/hugegraph/hugegraph/issues) 与 [FAQ](https://hugegraph.github.io/hugegraph-doc/guides/faq.html) 中没有相同 / 重复问题
### Environment (环境信息)
- Server Version: v0.11.2
- Backend: memory
- OS: 1 CPU, 2 G RAM, Centos 7.x
- Data Size: 100 vertices, 200 edges
### Expected & Actual behavior (期望与实际表现)
**Expected Behavior**
We want to search for String values using the between() API, `i.e.,“g.E().has('read', 'location', between('location1', 'location2'))”`. The expected behavior is that we can get the query results, just as we did in JanusGraph. We indexed properties using shard() and search() mode.
**Current Behavior**
However, an exception was thrown in either shard and search mode.
`java.lang.IllegalArgumentException: Can't compare between 2 >= location1 and 2 < location2 at com.baidu.hugegraph.exception.ServerException.fromResponse(ServerException.java:47)
at com.baidu.hugegraph.client.RestClient.checkStatus(RestClient.java:93)
at com.baidu.hugegraph.rest.AbstractRestClient.post(AbstractRestClient.java:198)
at com.baidu.hugegraph.rest.AbstractRestClient.post(AbstractRestClient.java:172)
at com.baidu.hugegraph.api.gremlin.GremlinAPI.post(GremlinAPI.java:41)
at com.baidu.hugegraph.driver.GremlinManager.execute(GremlinManager.java:51) at com.baidu.hugegraph.api.gremlin.GremlinRequest$Builder.execute(GremlinRequest.java:55) `
**Steps to Reporduce**
```
hugegraph.schema().propertyKey("name").asText().ifNotExist().create();
hugegraph.schema().propertyKey("location").asText().ifNotExist().create();
hugegraph.schema().propertyKey("mood").asText().ifNotExist().create();
// vertex
hugegraph.schema().vertexLabel("person").properties("name").nullableKeys("name").create();
hugegraph.schema().indexLabel("personbyname").onV("person").by("name").shard().ifNotExist().create();
hugegraph.schema().vertexLabel("book").properties("name").nullableKeys("name").create();
hugegraph.schema().indexLabel("bookbyname").onV("book").by("name").shard().ifNotExist().create();
// edge
hugegraph.schema().edgeLabel("read").sourceLabel("person").targetLabel("book").properties("location", "mood").ifNotExist().create();
hugegraph.schema().indexLabel("readByLocation").onE("read").by("location").shard().ifNotExist().create();
hugegraph.schema().indexLabel("readByMood").onE("read").by("mood").search().ifNotExist().create();
GraphManager graph = hugegraph.graph();
/** create graph data */
Vertex nancy = new Vertex("person").property("name", "nancy");
Vertex book1 = new Vertex("book").property("name", "book1");
Vertex book2 = new Vertex("book").property("name", "book2");
Vertex book3 = new Vertex("book").property("name", "book3");
graph.addVertices(Arrays.asList(nancy, book1, book2, book3));
Edge edge1 = new Edge("read").source(nancy).target(book1).property("location", "location1").property("mood", "good");
Edge edge2 = new Edge("read").source(nancy).target(book2).property("location", "location2").property("mood", "bad");
Edge edge3 = new Edge("read").source(nancy).target(book3).property("location", "location3").property("mood", "good");
graph.addEdges(Arrays.asList(edge1, edge2, edge3));
GremlinManager gremlin = hugegraph.gremlin();
try{
ResultSet hugeResult = gremlin.gremlin("g.E().has('read', 'location', between('location1', 'location3'))").execute();
Iterator huresult = hugeResult.iterator();
huresult.forEachRemaining(result -> {
Object object = result.getObject();
System.out.println(object);
});
}catch(Exception e){
e.printStackTrace();
}
try{
ResultSet hugeResult1 = gremlin.gremlin("g.E().has('read', 'mood', between('good', 'good'))").execute();
Iterator huresult1 = hugeResult1.iterator();
huresult1.forEachRemaining(result -> {
Object object = result.getObject();
System.out.println(object);
});
}catch (Exception e){
e.printStackTrace();
}
```
### Vertex/Edge example (问题点 / 边数据举例)
_No response_
### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.