Search in sources :

Example 6 with NodeIdsIndexReaderQueryAnswer

use of org.neo4j.kernel.impl.index.schema.NodeIdsIndexReaderQueryAnswer in project neo4j by neo4j.

the class PartitionedValueIndexReaderTest method rangeSeekByPrefixOverPartitions.

@Test
void rangeSeekByPrefixOverPartitions() throws Exception {
    PartitionedValueIndexReader indexReader = createPartitionedReaderFromReaders();
    PropertyIndexQuery.StringPrefixPredicate query = PropertyIndexQuery.stringPrefix(1, stringValue("prefix"));
    doAnswer(new NodeIdsIndexReaderQueryAnswer(schemaIndexDescriptor, 1)).when(indexReader1).query(any(), any(), any(), any());
    doAnswer(new NodeIdsIndexReaderQueryAnswer(schemaIndexDescriptor, 2)).when(indexReader2).query(any(), any(), any(), any());
    doAnswer(new NodeIdsIndexReaderQueryAnswer(schemaIndexDescriptor, 3)).when(indexReader3).query(any(), any(), any(), any());
    LongSet results = queryResultAsSet(indexReader, query);
    verifyResult(results);
}
Also used : NodeIdsIndexReaderQueryAnswer(org.neo4j.kernel.impl.index.schema.NodeIdsIndexReaderQueryAnswer) PropertyIndexQuery(org.neo4j.internal.kernel.api.PropertyIndexQuery) LongSet(org.eclipse.collections.api.set.primitive.LongSet) Test(org.junit.jupiter.api.Test)

Example 7 with NodeIdsIndexReaderQueryAnswer

use of org.neo4j.kernel.impl.index.schema.NodeIdsIndexReaderQueryAnswer in project neo4j by neo4j.

the class PartitionedValueIndexReaderTest method seekOverAllPartitions.

@Test
void seekOverAllPartitions() throws Exception {
    PartitionedValueIndexReader indexReader = createPartitionedReaderFromReaders();
    PropertyIndexQuery.ExactPredicate query = PropertyIndexQuery.exact(1, "Test");
    doAnswer(new NodeIdsIndexReaderQueryAnswer(schemaIndexDescriptor, 1)).when(indexReader1).query(any(), any(), any(), any());
    doAnswer(new NodeIdsIndexReaderQueryAnswer(schemaIndexDescriptor, 2)).when(indexReader2).query(any(), any(), any(), any());
    doAnswer(new NodeIdsIndexReaderQueryAnswer(schemaIndexDescriptor, 3)).when(indexReader3).query(any(), any(), any(), any());
    LongSet results = queryResultAsSet(indexReader, query);
    verifyResult(results);
}
Also used : NodeIdsIndexReaderQueryAnswer(org.neo4j.kernel.impl.index.schema.NodeIdsIndexReaderQueryAnswer) PropertyIndexQuery(org.neo4j.internal.kernel.api.PropertyIndexQuery) LongSet(org.eclipse.collections.api.set.primitive.LongSet) Test(org.junit.jupiter.api.Test)

Example 8 with NodeIdsIndexReaderQueryAnswer

use of org.neo4j.kernel.impl.index.schema.NodeIdsIndexReaderQueryAnswer in project neo4j by neo4j.

the class FusionIndexReaderTest method initiateMocks.

private void initiateMocks() throws IndexNotApplicableKernelException {
    IndexSlot[] activeSlots = fusionVersion.aliveSlots();
    readers = new EnumMap<>(IndexSlot.class);
    fill(readers, ValueIndexReader.EMPTY);
    aliveReaders = new ValueIndexReader[activeSlots.length];
    for (int i = 0; i < activeSlots.length; i++) {
        var mock = mock(ValueIndexReader.class);
        doAnswer(new NodeIdsIndexReaderQueryAnswer(DESCRIPTOR)).when(mock).query(any(), any(), any(), any());
        aliveReaders[i] = mock;
        switch(activeSlots[i]) {
            case GENERIC:
                readers.put(GENERIC, mock);
                break;
            case LUCENE:
                readers.put(LUCENE, mock);
                break;
            default:
                throw new RuntimeException();
        }
    }
    fusionIndexReader = new FusionIndexReader(fusionVersion.slotSelector(), new LazyInstanceSelector<>(readers, throwingFactory()), TestIndexDescriptorFactory.forLabel(LABEL_KEY, PROP_KEY));
}
Also used : NodeIdsIndexReaderQueryAnswer(org.neo4j.kernel.impl.index.schema.NodeIdsIndexReaderQueryAnswer)

Aggregations

NodeIdsIndexReaderQueryAnswer (org.neo4j.kernel.impl.index.schema.NodeIdsIndexReaderQueryAnswer)8 Test (org.junit.jupiter.api.Test)7 LongSet (org.eclipse.collections.api.set.primitive.LongSet)6 PropertyIndexQuery (org.neo4j.internal.kernel.api.PropertyIndexQuery)6 InOrder (org.mockito.InOrder)1 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)1 CursorContext (org.neo4j.io.pagecache.context.CursorContext)1 IndexUpdater (org.neo4j.kernel.api.index.IndexUpdater)1 ValueIndexReader (org.neo4j.kernel.api.index.ValueIndexReader)1 NodeValueIterator (org.neo4j.kernel.impl.index.schema.NodeValueIterator)1