Search code examples
neo4jspring-data-neo4jneo4j-ogmspring-data-neo4j-5

Spring Data Neo4j 5 and @Index for dynamic @Properties


Hot to properly index SDN 5 dynamic @Properties?

Will the following property declaration work:

@Index(unique = false)
@Properties(prefix = NAME_PROPERTY_PREFIX)
private Map<String, String> nameProperties = new HashMap<>();

will all properties keys inside of nameProperties map be indexed separately? Please describe.


Solution

  • This feature is not supported because the index creation, if auto index is enabled, will scan the classes on application start. Since there are no known fields (map keys) to be discovered when the class got scanned there is no index created.

    Additionally when I tried your sample from above, I saw that an useless index on the property fields name (nameProperties) gets created that is never used in Neo4j.