DATAGRAPH-232 Initially create the indexes used for the type-representation-strategy (__types__ and __rel_types__) so that generated cypher queries don't complain about missing indices on an empty database
This commit is contained in:
@@ -44,6 +44,7 @@ public abstract class AbstractIndexingTypeRepresentationStrategy<S extends Prope
|
||||
this.indexProvider = indexProvider;
|
||||
INDEX_NAME = indexName;
|
||||
this.clazz = clazz;
|
||||
getTypesIndex();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.neo4j.test.ImpermanentGraphDatabase;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.neo4j.conversion.EndResult;
|
||||
import org.springframework.data.neo4j.model.Person;
|
||||
import org.springframework.test.context.CleanContextCacheTestExecutionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
@@ -55,6 +56,12 @@ public class NoIndexDerivedFinderTest {
|
||||
assertEquals(0,IteratorUtil.count(result));
|
||||
}
|
||||
|
||||
@Test @Transactional
|
||||
public void findAllInitiallyWithoutIndexCreation() {
|
||||
EndResult<Person> result = personRepository.findByHeight( (short) 100 );
|
||||
assertEquals(0,IteratorUtil.count( result ));
|
||||
}
|
||||
|
||||
@Test @Transactional
|
||||
public void findByName() {
|
||||
Iterable<Person> result = personRepository.findByName("");
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.data.neo4j.annotation.MapResult;
|
||||
import org.springframework.data.neo4j.annotation.Query;
|
||||
import org.springframework.data.neo4j.annotation.QueryType;
|
||||
import org.springframework.data.neo4j.annotation.ResultColumn;
|
||||
import org.springframework.data.neo4j.conversion.EndResult;
|
||||
import org.springframework.data.neo4j.model.Group;
|
||||
import org.springframework.data.neo4j.model.Person;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
@@ -84,6 +85,8 @@ public interface PersonRepository extends GraphRepository<Person>, NamedIndexRep
|
||||
@Query("start person=node:`name-index`('name:*') return person.name as name, person order by name asc ")
|
||||
Iterable<NameAndPersonResult> getAllNamesAndPeople();
|
||||
|
||||
EndResult<Person> findByHeight( short height );
|
||||
|
||||
@MapResult
|
||||
interface NameAndPersonResult
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user