Skip to content

Search by @DynamicLabels #2638

@iva-bashmat

Description

@iva-bashmat

There is a way to retrieve dynamic labels for a node, but no way to create method to search by them.
Check following example:

Node:

@Node("Port")
public class Port {
    @Id
    private Long id;
    private String code;
    @DynamicLabels
    private List<String> labels;
}

Repository:

public interface PortRepository extends Neo4jRepository<Port, Long> {
    List<Port> findByLabelsContaining(String label);
}

Actual query:

MATCH (port:`Port`) 
WHERE $label IN port.labels
RETURN port{.code, .id, __nodeLabels__: labels(port), __internalNeo4jId__: id(port)}

Expected query:

MATCH (port:`Port`) 
WHERE $label IN labels(port)
RETURN port{.code, .id, __nodeLabels__: labels(port), __internalNeo4jId__: id(port)}

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions