use of com.tinkerpop.blueprints.impls.neo4j2.index.Neo4j2VertexIndex in project blueprints by tinkerpop.
the class Neo4j2GraphSpecificTestSuite method testLuceneQueryIndex.
public void testLuceneQueryIndex() throws Exception {
Neo4j2Graph graph = (Neo4j2Graph) graphTest.generateGraph();
Index<Vertex> vertexIndex = graph.createIndex("vertices", Vertex.class);
Vertex a = graph.addVertex(null);
vertexIndex.put("name", "marko", a);
Iterator<Vertex> ittyLuceneQuery = ((Neo4j2VertexIndex) graph.getIndex("vertices", Vertex.class)).query("name:*rko").iterator();
int counter = 0;
while (ittyLuceneQuery.hasNext()) {
counter++;
assertEquals(a, ittyLuceneQuery.next());
}
assertEquals(counter, 1);
vertexIndex.put("name", "marko some_other name", graph.addVertex(null));
ittyLuceneQuery = ((Neo4j2VertexIndex) graph.getIndex("vertices", Vertex.class)).query("name:*rko*").iterator();
counter = 0;
while (ittyLuceneQuery.hasNext()) {
ittyLuceneQuery.next();
counter++;
}
assertEquals(2, counter);
graph.shutdown();
}
Aggregations