use of org.neo4j.storageengine.api.schema.IndexSample in project neo4j by neo4j.
the class PartitionedIndexReaderTest method samplingOverPartitions.
@Test
public void samplingOverPartitions() throws IndexNotFoundKernelException {
PartitionedIndexReader indexReader = createPartitionedReaderFromReaders();
when(indexReader1.createSampler()).thenReturn(new SimpleSampler(1));
when(indexReader2.createSampler()).thenReturn(new SimpleSampler(2));
when(indexReader3.createSampler()).thenReturn(new SimpleSampler(3));
IndexSampler sampler = indexReader.createSampler();
assertEquals(new IndexSample(6, 6, 6), sampler.sampleIndex());
}
use of org.neo4j.storageengine.api.schema.IndexSample in project neo4j by neo4j.
the class NonUniqueDatabaseIndexPopulatingUpdaterTest method verifySamplingResult.
private static void verifySamplingResult(NonUniqueIndexSampler sampler, long expectedIndexSize, long expectedUniqueValues, long expectedSampleSize) {
IndexSample sample = sampler.result();
assertEquals(expectedIndexSize, sample.indexSize());
assertEquals(expectedUniqueValues, sample.uniqueValues());
assertEquals(expectedSampleSize, sample.sampleSize());
}
use of org.neo4j.storageengine.api.schema.IndexSample in project neo4j by neo4j.
the class LuceneSchemaIndexPopulationIT method partitionedIndexPopulation.
@Test
public void partitionedIndexPopulation() throws Exception {
try (SchemaIndex uniqueIndex = LuceneSchemaIndexBuilder.create(descriptor).withFileSystem(fileSystemRule.get()).withIndexRootFolder(testDir.directory("partitionIndex" + affectedNodes)).withIndexIdentifier("uniqueIndex" + affectedNodes).build()) {
uniqueIndex.open();
// index is empty and not yet exist
assertEquals(0, uniqueIndex.allDocumentsReader().maxCount());
assertFalse(uniqueIndex.exists());
try (LuceneIndexAccessor indexAccessor = new LuceneIndexAccessor(uniqueIndex, descriptor)) {
generateUpdates(indexAccessor, affectedNodes);
indexAccessor.force();
// now index is online and should contain updates data
assertTrue(uniqueIndex.isOnline());
try (IndexReader indexReader = indexAccessor.newReader()) {
long[] nodes = PrimitiveLongCollections.asArray(indexReader.query(IndexQuery.exists(1)));
assertEquals(affectedNodes, nodes.length);
IndexSampler indexSampler = indexReader.createSampler();
IndexSample sample = indexSampler.sampleIndex();
assertEquals(affectedNodes, sample.indexSize());
assertEquals(affectedNodes, sample.uniqueValues());
assertEquals(affectedNodes, sample.sampleSize());
}
}
}
}
use of org.neo4j.storageengine.api.schema.IndexSample in project neo4j by neo4j.
the class MultipleIndexPopulatorUpdatesTest method createIndexPopulator.
private IndexPopulator createIndexPopulator() {
IndexPopulator populator = mock(IndexPopulator.class);
when(populator.sampleResult()).thenReturn(new IndexSample());
return populator;
}
use of org.neo4j.storageengine.api.schema.IndexSample in project neo4j by neo4j.
the class DefaultNonUniqueIndexSamplerTest method assertSampledValues.
private void assertSampledValues(NonUniqueIndexSampler sampler, long expectedIndexSize, long expectedUniqueValues, long expectedSampledSize) {
IndexSample sample = sampler.result();
assertEquals(expectedIndexSize, sample.indexSize());
assertEquals(expectedUniqueValues, sample.uniqueValues());
assertEquals(expectedSampledSize, sample.sampleSize());
}
Aggregations