Results 1 to 3 of 3

Thread: Facing issues with cypher query support

  1. #1
    Join Date
    Dec 2011
    Posts
    1

    Default Facing issues with cypher query support

    Hi

    We are using SpringData 2.0.0 RC1 and Neo4J as our primary datastore.

    For searching, we are creating using the following at the repository level -
    public interface UserRepository extends GraphRepository<User>, NamedIndexRepository<User> {

    public final static String USR_SRCH_QUERY="start unode = node:__types__(className=\"User\") " +
    "match (unode)-[r1]->(folder)-[r2]-(member) " +
    "where (member.firstName=~/A.*/) and" +
    "type(r1)=~/HAS_FOLDER|MEMBERSHIP/ and type(r2)=~/CONTACT|MEMBERSHIP/ " +
    "and unode.userName=/a.*/ " +
    "return member, type(r2) " +
    "order by type(r2), member.role,member.firstName, member.lastName, member.userName";


    @Query(USR_SRCH_QUERY)
    public List<UserSearchNode> getUsersInCommunity(String currentUser, String searchQuery);

    }

    We have an object that is used to map the result -
    @MapResult
    public interface UserSearchNode {

    @ResultColumn("member")
    User getUserNode();

    @ResultColumn("TYPE(r2)")
    String getRelType();
    }

    we are invoking this through some test as follows

    String usr = "a.b@gmail.com";
    List<UserSearchNode> usersNodes = userDao.getUsersInCommunity(usr,"a");
    for (UserSearchNode userNode : usersNodes) {
    System.out.println(userNode.getRelType() + ":" + userNode.getUserNode().getUserName());
    }

    On invocation the query doesnt work saying - SyntaxException - expected ')'; 'r' found.

    if we change the expression for matching username to - 'and unode.userName=/(?i)a.*/', then we dont get the correct result.

    We printed the query that is formed and sent across to neo4J and tried it on the cypher console - the query works perfectly.

    Can someone help us solve this?

  2. #2
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    As mentioned in the neo4j google group, this is a bug in cypher in older versions of Neo4j will be resolved tomorrow, when we release SDN 2.0 with support for Neo4j 1.6.M02.

    Cheers

    Michael

  3. #3
    Join Date
    Jan 2011
    Location
    Dresden, Germany
    Posts
    525

    Default

    Please check and report back.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •