Announcement Announcement Module
Collapse
No announcement yet.
Neo4j - @Query Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Neo4j - @Query

    I'm using the most recent snapshot of neo4j and am having some issues with a cypher query in with @Query.

    Example:
    @Query(value="START n = node:__types__(className='my.package.Model') MATCH (n)-[:STRING_ATTRIBUTE]->(a) WHERE a.type =~ {t} and a.value = {v} RETURN n", type=QueryType.Cypher)
    List<Models> findModels(@Param("t") String type, @Param("v") String value);

    When I call my function, i.e. dao.findModels("/(?i)first name/", "/(?i)john|bob/"), I get no results. It will yield results if I use the case sensitive query on one property...but not both.

    If I try the query in a template call, I get the results as expected.
    Example:
    template.query("START n = node:__types__(className='my.package.Model') MATCH (n)-[:STRING_ATTRIBUTE]->(a) WHERE a.type =~ /(?i)first name/ and a.value = /(?i)john|bob/ RETURN n", null);

    The @Query also fails if I put valid regex patterns in the value for canned queries.
    Example:
    @Query(value="START n = node:__types__(className='my.package.Model') MATCH (n)-[:STRING_ATTRIBUTE]->(a) WHERE a.type =~ /(?i){t}/ and a.value = /(?i){v}/ RETURN n", type=QueryType.Cypher)
    List<Models> findModels(@Param("t") String type, @Param("v") String value);

    I looked through the documentation and didn't notice any limitations for cypher queries in @Query. Is this a bug?

  • #2
    Originally posted by jlorentzen View Post
    I'm using the most recent snapshot of neo4j and am having some issues with a cypher query in with @Query.

    Example:
    @Query(value="START n = node:__types__(className='my.package.Model') MATCH (n)-[:STRING_ATTRIBUTE]->(a) WHERE a.type =~ {t} and a.value = {v} RETURN n", type=QueryType.Cypher)
    List<Models> findModels(@Param("t") String type, @Param("v") String value);

    When I call my function, i.e. dao.findModels("/(?i)first name/", "/(?i)john|bob/"), I get no results. It will yield results if I use the case sensitive query on one property...but not both.

    ...

    Is this a bug?
    That certainly doesn't look good. Can I get you to raise an issue here: https://jira.springsource.org/browse/DATAGRAPH

    Thanks,

    Lasse

    Comment

    Working...
    X