public Representation getAutoIndexedRelationships(String key, String value) { List<Representation> representations = new ArrayList<Representation>(); ReadableRelationshipIndex index = graphDb.index().getRelationshipAutoIndexer().getAutoIndex(); Transaction tx = graphDb.beginTx(); try { for (Relationship rel : index.get(key, value)) { representations.add(new RelationshipRepresentation(rel)); } tx.success(); return new ListRepresentation(RepresentationType.RELATIONSHIP, representations); } finally { tx.finish(); } }
public ListRepresentation getAutoIndexedRelationshipsByQuery(String query) { ReadableRelationshipIndex index = graphDb.index().getRelationshipAutoIndexer().getAutoIndex(); List<Representation> representations = new ArrayList<Representation>(); if (query != null) { Transaction tx = graphDb.beginTx(); try { for (Relationship rel : index.query(query)) { representations.add(new RelationshipRepresentation(rel)); } tx.success(); } finally { tx.finish(); } } return new ListRepresentation(RepresentationType.RELATIONSHIP, representations); }