use of org.neo4j.internal.kernel.api.IndexReadSession in project neo4j by neo4j.
the class EntityValueIndexCursorTestBase method shouldNotFindUpdatedEntityInIndexSeek.
@Test
void shouldNotFindUpdatedEntityInIndexSeek() 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.entitySetProperty(tx, strOne, prop, "ett");
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 shouldFindUpdatedEntityInRangeSearch.
@Test
void shouldFindUpdatedEntityInRangeSearch() 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.range(prop, "ett", true, "tre", true));
// 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 shouldFindSwappedEntityInRangeSearch.
@Test
void shouldFindSwappedEntityInRangeSearch() throws Exception {
assumeTrue(entityParams.tokenlessEntitySupported());
// Given
boolean needsValues = indexParams.indexProvidesStringValues();
int label = entityParams.entityTokenId(tx, DEFAULT_ENTITY_TOKEN);
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.entityRemoveToken(tx, strOne, label);
entityParams.entityAddToken(tx, strOneNoLabel, label);
entityParams.entityIndexSeek(tx, index, cursor, unordered(needsValues), PropertyIndexQuery.range(prop, "one", true, "ones", true));
// then
assertTrue(cursor.next());
assertEquals(strOneNoLabel, entityParams.entityReference(cursor));
assertFalse(cursor.next());
}
}
use of org.neo4j.internal.kernel.api.IndexReadSession in project neo4j by neo4j.
the class EntityValueIndexCursorTestBase method shouldProvideValuesForPoints.
@Test
void shouldProvideValuesForPoints() throws Exception {
// given
assumeTrue(indexParams.indexProvidesSpatialValues());
int prop = token.propertyKey(EVER_PROP_NAME);
IndexReadSession index = read.indexReadSession(schemaRead.indexGetForName(WHAT_EVER_INDEX_NAME));
assertEquals(IndexValueCapability.YES, index.reference().getCapability().valueCapability(ValueCategory.GEOMETRY));
try (var cursor = entityParams.allocateEntityValueIndexCursor(tx, cursors)) {
MutableLongSet uniqueIds = new LongHashSet();
// when
entityParams.entityIndexSeek(tx, index, cursor, unorderedValues(), PropertyIndexQuery.range(prop, Cartesian));
// then
assertFoundEntitiesAndValue(cursor, uniqueIds, index.reference().getCapability().valueCapability(ValueCategory.GEOMETRY), true, whateverPoint);
}
}
use of org.neo4j.internal.kernel.api.IndexReadSession in project neo4j by neo4j.
the class EntityValueIndexCursorTestBase method shouldFindSwappedEntityInCompositeIndex.
@Test
void shouldFindSwappedEntityInCompositeIndex() throws Exception {
assumeTrue(entityParams.tokenlessEntitySupported());
// Given
boolean needsValues = false;
int label = entityParams.entityTokenId(tx, PERSON_TOKEN);
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.entityRemoveToken(tx, joeDalton, label);
entityParams.entityAddToken(tx, strOneNoLabel, label);
entityParams.entitySetProperty(tx, strOneNoLabel, firstName, "Jesse");
entityParams.entitySetProperty(tx, strOneNoLabel, surname, "James");
entityParams.entityIndexSeek(tx, index, cursor, unordered(needsValues), PropertyIndexQuery.exact(firstName, "Jesse"), PropertyIndexQuery.exact(surname, "James"));
// then
assertTrue(cursor.next());
assertEquals(strOneNoLabel, entityParams.entityReference(cursor));
}
}
Aggregations