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);
}
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);
}
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));
}
Aggregations