Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]within do not return the correct result #1794

Closed
1 task done
zhouliweb opened this issue Mar 23, 2022 · 5 comments · Fixed by #1803
Closed
1 task done

[Bug]within do not return the correct result #1794

zhouliweb opened this issue Mar 23, 2022 · 5 comments · Fixed by #1803
Labels
bug Something isn't working

Comments

@zhouliweb
Copy link

zhouliweb commented Mar 23, 2022

Bug Type (问题类型)

gremlin (结果不合预期)

Before submit

  • 我已经确认现有的 IssuesFAQ 中没有相同 / 重复问题

Environment (环境信息)

  • Server Version: v0.11.x
  • Backend: RocksDB x nodes, HDD or SSD
  • OS: xx CPUs, xx G RAM, Centos 7.x
  • Data Size: xx vertices, xx edges

Expected & Actual behavior (期望与实际表现)

使用within直接查询能起作用,但是多次拼接查询,没数据

gremlin> :> g.V().has('name',Text.contains('诚信')).has('type', 0).where(values('confirmType').is(neq(1))).valueMap('name','confirmType').limit(1)
==>[name:[诚信],confirmType:[0]]
gremlin> :> g.V().has('name',Text.contains('诚信')).has('type', 0).has('confirmType',within(0,2,3)).valueMap('name','confirmType').limit(1)
gremlin>
gremlin> :> g.V().has('type', 0).has('confirmType',within(0,2,3)).has('name',Text.contains('诚信')).valueMap('name','confirmType').limit(1)
gremlin>
gremlin> :> g.V().has('type', 0).has('name',Text.contains('诚信')).has('confirmType',within(3,2,0)).valueMap('name','confirmType').limit(1)
==>[name:[诚信],confirmType:[0]]
gremlin> :> g.V().has('type', 0).has('name',Text.contains('诚信')).valueMap('name','confirmType').limit(1)
==>[name:[诚信],confirmType:[0]]
gremlin> :> g.V().has('type', 0).has('name',Text.contains('诚信')).has('confirmType',0).valueMap('name','confirmType').limit(1)
==>[name:[诚信],confirmType:[0]]

Vertex/Edge example (问题点 / 边数据举例)

No response

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

schema.propertyKey("type").asInt().ifNotExist().create();
schema.propertyKey("kid").asInt().ifNotExist().create();
schema.propertyKey("name").asText().ifNotExist().create();
schema.propertyKey("confirmType").asInt().ifNotExist().create();

schema.vertexLabel("test").properties("confirmType","name","kid","type").nullableKeys("confirmType","name","type").primaryKeys("kid").ifNotExist().create();

g.addVertex(T.label, "tets", "name", "诚信", "confirmType", 0, "type", 1,"kid",1);
g.V().has('type', 1).has('confirmType',within(0,2,3)).has('name',Text.contains('诚信'));
g.V().has('type', 1).has('confirmType',within(3,2,0)).has('name',Text.contains('诚信'));

No response

@zhouliweb zhouliweb added the bug Something isn't working label Mar 23, 2022
@javeme
Copy link
Contributor

javeme commented Mar 24, 2022

@zhouliweb 感谢反馈,出了查询语句,能否再提供下后端存储、版本号、示例数据呢?以便于我们复现该问题

@zhouliweb
Copy link
Author

@zhouliweb 感谢反馈,出了查询语句,能否再提供下后端存储、版本号、示例数据呢?以便于我们复现该问题

已经增加示例数据

@javeme
Copy link
Contributor

javeme commented Mar 25, 2022

@zhouliweb 收到更新,谢谢。请问是否有创建索引呢?

@javeme
Copy link
Contributor

javeme commented Mar 25, 2022

已确认该问题是关于search-index的Bug,我们尽快修复。可以暂时去除has('name',Text.contains('诚信'))条件进行查询,或者使用filter临时代替:
g.V().has('type', 1).has('confirmType',within(0,2,3)).filter{it.get().value('name').contains('诚信')};

另外,示例存在一些小问题,已更正:

schema.propertyKey('type').asInt().ifNotExist().create(); 
schema.propertyKey('kid').asInt().ifNotExist().create();
schema.propertyKey('name').asText().ifNotExist().create(); 
schema.propertyKey('confirmType').asInt().ifNotExist().create(); 

schema.vertexLabel('test').properties('confirmType','name','kid','type').nullableKeys('confirmType','name','type').primaryKeys('kid').ifNotExist().create();

schema.indexLabel('test_by_type').onV('test').by('type').range().ifNotExist().create();
schema.indexLabel('test_by_confirmType').onV('test').by('confirmType').range().ifNotExist().create();
schema.indexLabel('test_by_name').onV('test').by('name').search().ifNotExist().create();

graph.addVertex(T.label, 'test', 'name', '诚信', 'confirmType', 0, 'type', 1, 'kid', 0);
graph.addVertex(T.label, 'test', 'name', '诚信', 'confirmType', 1, 'type', 1, 'kid', 1);
graph.addVertex(T.label, 'test', 'name', '诚信文明', 'confirmType', 2, 'type', 1, 'kid', 2);
graph.addVertex(T.label, 'test', 'name', '诚信文明', 'confirmType', 3, 'type', 1, 'kid', 3);

g.V().has('type', 1).has('confirmType',within(0,2,3)).has('name',Text.contains('诚信'));

@zhouliweb
Copy link
Author

请问是否有创建索引呢?

谢谢答复

javeme added a commit that referenced this issue Mar 29, 2022
fix #1794

Change-Id: I4f4f2f52b6986ca5af9a27ee4677e16387235c0b
imbajin pushed a commit that referenced this issue Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants