use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class IndexTransactionStateTestBase method shouldPerformStringRangeSearchWithRemovedRemovedPropertyInTxState.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
void shouldPerformStringRangeSearchWithRemovedRemovedPropertyInTxState(boolean needsValues) throws Exception {
// given
Set<Pair<Long, Value>> expected = new HashSet<>();
long entityToChange;
try (KernelTransaction tx = beginTransaction()) {
entityToChange = entityWithPropId(tx, "banana");
entityWithPropId(tx, "apple");
tx.commit();
}
createIndex();
// when
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "cherry"));
entityWithProp(tx, "dragonfruit");
IndexDescriptor index = tx.schemaRead().indexGetForName(INDEX_NAME);
removeProperty(tx, entityToChange);
int prop = tx.tokenRead().propertyKey(DEFAULT_PROPERTY_NAME);
assertEntityAndValueForSeek(expected, tx, index, needsValues, "berry", PropertyIndexQuery.range(prop, "b", true, "d", false));
}
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class IndexTransactionStateTestBase method shouldPerformStringRangeSearchWithAddedEntityInTxState.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
void shouldPerformStringRangeSearchWithAddedEntityInTxState(boolean needsValues) throws Exception {
// given
Set<Pair<Long, Value>> expected = new HashSet<>();
long entityToChange;
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "banana"));
entityToChange = entityWithPropId(tx, "apple");
tx.commit();
}
createIndex();
// when
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "cherry"));
entityWithProp(tx, "dragonfruit");
IndexDescriptor index = tx.schemaRead().indexGetForName(INDEX_NAME);
TextValue newProperty = stringValue("blueberry");
setProperty(tx, entityToChange, newProperty);
expected.add(Pair.of(entityToChange, newProperty));
int prop = tx.tokenRead().propertyKey(DEFAULT_PROPERTY_NAME);
assertEntityAndValueForSeek(expected, tx, index, needsValues, "berry", PropertyIndexQuery.range(prop, "b", true, "d", false));
}
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class IndexTransactionStateTestBase method shouldPerformEqualitySeek.
@Test
void shouldPerformEqualitySeek() throws Exception {
// given
Set<Pair<Long, Value>> expected = new HashSet<>();
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "banana"));
entityWithProp(tx, "apple");
tx.commit();
}
createIndex();
// when
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "banana"));
entityWithProp(tx, "dragonfruit");
IndexDescriptor index = tx.schemaRead().indexGetForName(INDEX_NAME);
// Equality seek does never provide values
int prop = tx.tokenRead().propertyKey(DEFAULT_PROPERTY_NAME);
assertEntityAndValueForSeek(expected, tx, index, false, "banana", PropertyIndexQuery.exact(prop, "banana"));
}
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class IndexTransactionStateTestBase method shouldPerformStringSuffixSearch.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
void shouldPerformStringSuffixSearch(boolean needsValues) throws Exception {
// given
Set<Pair<Long, Value>> expected = new HashSet<>();
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "1suff"));
entityWithProp(tx, "pluff");
tx.commit();
}
createIndex();
// when
try (KernelTransaction tx = beginTransaction()) {
int prop = tx.tokenRead().propertyKey(DEFAULT_PROPERTY_NAME);
expected.add(entityWithProp(tx, "2suff"));
entityWithPropId(tx, "skruff");
IndexDescriptor index = tx.schemaRead().indexGetForName(INDEX_NAME);
assertEntityAndValueForSeek(expected, tx, index, needsValues, "pasuff", PropertyIndexQuery.stringSuffix(prop, stringValue("suff")));
}
}
use of org.neo4j.internal.schema.IndexDescriptor in project neo4j by neo4j.
the class IndexTransactionStateTestBase method shouldPerformStringContainsSearch.
@ParameterizedTest
@ValueSource(strings = { "true", "false" })
void shouldPerformStringContainsSearch(boolean needsValues) throws Exception {
// given
Set<Pair<Long, Value>> expected = new HashSet<>();
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "gnomebat"));
entityWithPropId(tx, "fishwombat");
tx.commit();
}
createIndex();
// when
try (KernelTransaction tx = beginTransaction()) {
expected.add(entityWithProp(tx, "homeopatic"));
entityWithPropId(tx, "telephonecompany");
IndexDescriptor index = tx.schemaRead().indexGetForName(INDEX_NAME);
int prop = tx.tokenRead().propertyKey(DEFAULT_PROPERTY_NAME);
assertEntityAndValueForSeek(expected, tx, index, needsValues, "immense", PropertyIndexQuery.stringContains(prop, stringValue("me")));
}
}
Aggregations