简体   繁体   English

长期未使用spring-data-neo4j索引的类型的字段

[英]Field of type long not being indexed with spring-data-neo4j

Exactly as the title says. 恰如标题所说。 I've created an @NodeEntity annotated POJO and in it I have a field that I want to use as an identifier that is a long that I would like to index and search around. 我创建了一个@NodeEntity注释的POJO,并且在其中有一个我想用作标识符的字段,该字段long ,我想对其进行索引和搜索。

When I save my POJO using neo4jTemplate it saves okay, and I can see neo4j creating the index name for my Class, but when I attempt to query against the Index, I get nothing. 当我使用neo4jTemplate保存POJO时,它可以保存,并且可以看到neo4j为我的Class创建索引名称,但是当我尝试查询Index时,我什么也没得到。

I've tried the field with both int and long , but neither seem to work. 我已经尝试了intlong的领域,但似乎都行不通。 When querying, I've tried both 1 , 1l , and "1" but none return my Node. 查询时,我都试过11l"1" ,但没有回我的节点。

I can confirm that an index can be created with a Key/Value where the value is an int or a long and they work fine. 我可以确认可以使用键/值创建索引,其中值是intlong并且它们可以正常工作。

Has anyone else encountered this? 有人遇到过这种情况么?

It could be that in SDN primitives gets indexed as numerical, which has a special meaning in Lucene (the default index of choice for neo4j) and they need to be queries in a similar way to be found... namely with numerical range queries. 可能是因为在SDN原语中将其索引为数字,这在Lucene(neo4j的默认索引选择)中具有特殊含义,并且它们需要以类似的方式进行查询才能找到...即使用数字范围查询。 I don't know how that would look in SDN, but by using org.apache.lucene.search.NumericRangeQuery to create Query objects to search for ranges of primitives (for example int or long) those can be queried. 我不知道它在SDN中的外观,但是通过使用org.apache.lucene.search.NumericRangeQuery创建Query对象来搜索可以查询的原语范围(例如int或long)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM