Neo4j, SDN5 and index over Object field

71 Views Asked by At

I have the following SDN5 node entity:

@NodeEntity
public class Value {

    @Index(unique = false)
    private Object value;

}

As you may see, I have defined value as Object and placed the index over it.

According to my application business logic, I'm putting different Java types into the Value.value like String, Long, Double, Integer etc. Taking this into account I wondering will the Neo4j index effectively work there? Does it make any sense there? Please explain.

2

There are 2 best solutions below

2
On

Property values can only be of primitive types or arrays for node property.

0
On

I cannot tell you anything about performance but it is technically possible to do this.

One idea that came to my mind to avoid mixed types in the database would be to use a converter for the property that does nothing more than .toString() and back (might be ugly code for the conversion back to Java and discard some types e.g. there will be no difference in Double and Float).