Hi, i am having a problem with the @Indexed annotation. It only creates the index if i specify an indexname, otherwise it is not created
I have the following entity:
And i am testing the creation of the index with the following junit:Code:@NodeEntity public class User { @GraphId private Long id; @Indexed(unique = true) private String username; }
And is failing the test unless i put something like this (the test is not failing because of the index name, it is directly not being created, i verified this with the neo4j server):Code:@Test public void shallAutomaticlyCreateIndexes() { Index<PropertyContainer> usernameIndex = template.getIndex("username", User.class); Assert.assertNotNull(usernameIndex); }
Apart from the above problem, i am having an odd behaviour with the following test when the indexName is not specified in the @Indexed annotation.Code:@NodeEntity public class User { @GraphId private Long id; @Indexed(indexName = "username", unique = true) private String username; }
The above test is passing, although no lucene index is being created for the field (as verified in the previous JUnit), and if i did not get it wrong, only indexed fields can be searched for.Code:@Test public void shallGetByIndexedProperty() { User user = new User(USERNAME); user = userRepository.save(user); Iterable<User> usersDb = userRepository.findAllByPropertyValue( "username", USERNAME); Assert.assertTrue(Iterables.size(usersDb) == 1); }
I am using
Any thoughts?Code:<neo4j.version>1.8.RC1</neo4j.version> <spring-data-neo4j.version>2.1.0.BUILD-SNAPSHOT</spring-data-neo4j.version>


Reply With Quote