use of org.neo4j.internal.kernel.api.IndexReadSession in project neo4j by neo4j.
the class EntityValueIndexCursorTestBase method shouldNotFindDeletedEntityInIndexSeek.
@Test
void shouldNotFindDeletedEntityInIndexSeek() throws Exception {
// Given
boolean needsValues = false;
int prop = token.propertyKey(PROP_NAME);
IndexReadSession index = read.indexReadSession(schemaRead.indexGetForName(PROP_INDEX_NAME));
try (KernelTransaction tx = beginTransaction();
var cursor = entityParams.allocateEntityValueIndexCursor(tx, cursors)) {
// when
entityParams.entityDelete(tx, strOne);
entityParams.entityIndexSeek(tx, index, cursor, unordered(needsValues), PropertyIndexQuery.exact(prop, "one"));
// then
assertFalse(cursor.next());
}
}
use of org.neo4j.internal.kernel.api.IndexReadSession in project neo4j by neo4j.
the class EntityValueIndexCursorTestBase method shouldFindUpdatedEntityInPrefixSearch.
@Test
void shouldFindUpdatedEntityInPrefixSearch() throws Exception {
// Given
boolean needsValues = indexParams.indexProvidesStringValues();
int prop = token.propertyKey(PROP_NAME);
IndexReadSession index = read.indexReadSession(schemaRead.indexGetForName(PROP_INDEX_NAME));
try (KernelTransaction tx = beginTransaction();
var cursor = entityParams.allocateEntityValueIndexCursor(tx, cursors)) {
// when
entityParams.entitySetProperty(tx, strOne, prop, "ett");
entityParams.entityIndexSeek(tx, index, cursor, unordered(needsValues), PropertyIndexQuery.stringPrefix(prop, stringValue("et")));
// then
assertTrue(cursor.next());
assertEquals(strOne, entityParams.entityReference(cursor));
}
}
use of org.neo4j.internal.kernel.api.IndexReadSession in project neo4j by neo4j.
the class EntityValueIndexCursorTestBase method shouldPerformExactLookupInCompositeIndex.
@Test
void shouldPerformExactLookupInCompositeIndex() throws Exception {
// given
int firstName = token.propertyKey(FIRSTNAME_PROP_NAME);
int surname = token.propertyKey(SURNAME_PROP_NAME);
IndexReadSession index = read.indexReadSession(schemaRead.indexGetForName(COMPOSITE_INDEX_NAME));
try (var cursor = entityParams.allocateEntityValueIndexCursor(tx, cursors)) {
MutableLongSet uniqueIds = new LongHashSet();
// when
entityParams.entityIndexSeek(tx, index, cursor, unconstrained(), PropertyIndexQuery.exact(firstName, "Joe"), PropertyIndexQuery.exact(surname, "Dalton"));
// then
assertThat(cursor.numberOfProperties()).isEqualTo(2);
assertFoundEntitiesAndNoValue(cursor, 1, uniqueIds);
}
}
use of org.neo4j.internal.kernel.api.IndexReadSession in project neo4j by neo4j.
the class EntityValueIndexCursorTestBase method shouldNotFindDeletedEntityInPrefixSearch.
@Test
void shouldNotFindDeletedEntityInPrefixSearch() throws Exception {
// Given
boolean needsValues = indexParams.indexProvidesStringValues();
int prop = token.propertyKey(PROP_NAME);
IndexReadSession index = read.indexReadSession(schemaRead.indexGetForName(PROP_INDEX_NAME));
try (KernelTransaction tx = beginTransaction();
var cursor = entityParams.allocateEntityValueIndexCursor(tx, cursors)) {
// when
entityParams.entityDelete(tx, strOne);
entityParams.entityIndexSeek(tx, index, cursor, unordered(needsValues), PropertyIndexQuery.stringPrefix(prop, stringValue("on")));
// then
assertFalse(cursor.next());
}
}
use of org.neo4j.internal.kernel.api.IndexReadSession in project neo4j by neo4j.
the class EntityValueIndexCursorTestBase method shouldNotFindUpdatedEntityInCompositeIndex.
@Test
void shouldNotFindUpdatedEntityInCompositeIndex() throws Exception {
// Given
boolean needsValues = false;
int firstName = token.propertyKey(FIRSTNAME_PROP_NAME);
int surname = token.propertyKey(SURNAME_PROP_NAME);
IndexReadSession index = read.indexReadSession(schemaRead.indexGetForName(COMPOSITE_INDEX_NAME));
try (KernelTransaction tx = beginTransaction();
var cursor = entityParams.allocateEntityValueIndexCursor(tx, cursors)) {
// when
entityParams.entitySetProperty(tx, jackDalton, firstName, "Jesse");
entityParams.entitySetProperty(tx, jackDalton, surname, "James");
entityParams.entityIndexSeek(tx, index, cursor, unordered(needsValues), PropertyIndexQuery.exact(firstName, "Jack"), PropertyIndexQuery.exact(surname, "Dalton"));
// then
assertFalse(cursor.next());
}
}
Aggregations