Neo4J OGM querying issue

Hi, I'm Akila and I'm doing a small personal project to build a property searching system. I'm using spring boot with a neo4j database and I'm trying to query from the neo4j database using filters because I need the querying to be dynamic too. In my use case properties have features such as electricity, tap water, tiled roof, etc. Property & Feature are nodes, Feature node has an attribute named 'key', a Property node is linked to many Feature nodes by rich relationships typed HAS_FEATURE, what i want to do is query properties for a given array of feature keys using Filters. Following is the querying code,

featureKeys is a java List here,

filter = new Filter("key", ComparisonOperator.IN, featureKeys);





SESSION.loadAll(Property.class, filters, new Pagination(pageNumber, pageSize));

The problem is I want only the properties that are related to all the given features keys to be returned, but even the properties that are related to one element of the given feature key list is also returned. What do I need to do to query only the properties that are linked to all the given list elements, i can change the rich relationship to a normal relationship if needed, thank you in advance!

1 Like