use of org.neo4j.kernel.api.index.IndexProgressor in project neo4j by neo4j.
the class NativeIndexReader method startSeekForInitializedRange.
void startSeekForInitializedRange(IndexProgressor.EntityValueClient client, KEY treeKeyFrom, KEY treeKeyTo, PropertyIndexQuery[] query, IndexQueryConstraints constraints, boolean needFilter, CursorContext cursorContext) {
if (isEmptyRange(treeKeyFrom, treeKeyTo)) {
client.initialize(descriptor, IndexProgressor.EMPTY, query, constraints, false);
return;
}
try {
Seeker<KEY, VALUE> seeker = makeIndexSeeker(treeKeyFrom, treeKeyTo, constraints.order(), cursorContext);
IndexProgressor hitProgressor = getIndexProgressor(seeker, client, needFilter, query);
client.initialize(descriptor, hitProgressor, query, constraints, false);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.neo4j.kernel.api.index.IndexProgressor in project neo4j by neo4j.
the class DocValuesCollectorTest method shouldNotSaveScoresForIndexProgressorWhenNotRequired.
@Test
void shouldNotSaveScoresForIndexProgressorWhenNotRequired() throws Exception {
// given
DocValuesCollector collector = new DocValuesCollector(false);
IndexReaderStub readerStub = indexReaderWithMaxDocs(42);
// when
collector.doSetNextReader(readerStub.getContext());
collector.collect(1);
// then
AtomicReference<AcceptedEntity> ref = new AtomicReference<>();
IndexProgressor.EntityValueClient client = new EntityValueClientWritingToReference(ref);
IndexProgressor progressor = collector.getIndexProgressor("field", client);
assertTrue(progressor.next());
assertFalse(progressor.next());
progressor.close();
AcceptedEntity entity = ref.get();
assertThat(entity.reference).isEqualTo(1L);
assertTrue(Float.isNaN(entity.score));
}
use of org.neo4j.kernel.api.index.IndexProgressor in project neo4j by neo4j.
the class DefaultTokenIndexReader method query.
@Override
public void query(IndexProgressor.EntityTokenClient client, IndexQueryConstraints constraints, TokenPredicate query, EntityRange range, CursorContext cursorContext) {
try {
final int tokenId = query.tokenId();
final IndexOrder order = constraints.order();
Seeker<TokenScanKey, TokenScanValue> seeker = seekerForToken(range, tokenId, order, cursorContext);
IndexProgressor progressor = new TokenScanValueIndexProgressor(seeker, client, order, range);
client.initialize(progressor, tokenId, order);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.neo4j.kernel.api.index.IndexProgressor in project neo4j by neo4j.
the class NodeLabelIndexCursorScan method scanStore.
@Override
protected boolean scanStore(NodeLabelIndexCursor cursor, int sizeHint, LongIterator addedItems) {
DefaultNodeLabelIndexCursor indexCursor = (DefaultNodeLabelIndexCursor) cursor;
indexCursor.setRead(read);
IndexProgressor indexProgressor = storageScan.initializeBatch(indexCursor, sizeHint, cursorContext);
if (indexProgressor == IndexProgressor.EMPTY && !addedItems.hasNext()) {
return false;
} else {
indexCursor.initialize(indexProgressor, label, addedItems, removed);
return true;
}
}
use of org.neo4j.kernel.api.index.IndexProgressor in project neo4j by neo4j.
the class DocValuesCollectorTest method shouldSaveScoresForIndexProgressorWhenRequired.
@Test
void shouldSaveScoresForIndexProgressorWhenRequired() throws Exception {
// given
DocValuesCollector collector = new DocValuesCollector(true);
IndexReaderStub readerStub = indexReaderWithMaxDocs(42);
float score = 13.42f;
// when
collector.doSetNextReader(readerStub.getContext());
collector.setScorer(constantScorer(score));
collector.collect(1);
// then
AtomicReference<AcceptedEntity> ref = new AtomicReference<>();
IndexProgressor.EntityValueClient client = new EntityValueClientWritingToReference(ref);
IndexProgressor progressor = collector.getIndexProgressor("field", client);
assertTrue(progressor.next());
assertFalse(progressor.next());
progressor.close();
AcceptedEntity entity = ref.get();
assertThat(entity.reference).isEqualTo(1L);
assertThat(entity.score).isEqualTo(score);
}
Aggregations