Limitations of Filters to search data

301 views Asked by At

I am exploring how I can write generic query for any Node given a set of search parameters and came across org.neo4j.ogm.cypher.Filters (in neo4j-ogm-core-2.0.3.jar)

I would have liked to have more options for ComparisionOperator like CONTAINS, IN, STARTSWITH etc.

Right now the operators supported are:

  • EQUALS("=")
  • MATCHES("=~")
  • LIKE("=~", new CaseInsensitiveLikePropertyValueTransformer())
  • GREATER_THAN(">")
  • LESS_THAN("<")

Are there is any plan to enhance this to support more operations?

Here is an example of how I am using Filters:

public Collection<User> findUserByFirstNameLike(String firstName) {
    Filters filters = new Filters();
    Filter firstNameFilter = new Filter("firstName", firstName);
    firstNameFilter.setComparisonOperator(ComparisonOperator.LIKE);
    filters.add(firstNameFilter);
    Collection<User> users = session.loadAll(User.class, filters);
    return users;
}
1

There are 1 answers

4
digx1 On

Filters has been updated in neo4j-ogm-core version 2.1.0.

All 3 options you want to see (CONTAINS, IN, STARTS WITH) are available in this version along with:

  • LESS_THAN("<")
  • LESS_THAN_EQUAL("<=")
  • IS_NULL("IS NULL")
  • ENDING_WITH("ENDS WITH")
  • EXISTS("EXISTS")
  • IS_TRUE("=")