use of org.neo4j.kernel.api.impl.index.collector.DocValuesCollector in project neo4j by neo4j.
the class LuceneLegacyIndex method search.
private IndexHits<Document> search(IndexReference searcherRef, IndexSearcher fulltextTransactionStateSearcher, Query query, QueryContext additionalParametersOrNull, Collection<EntityId> removed) throws IOException {
if (fulltextTransactionStateSearcher != null && !removed.isEmpty()) {
letThroughAdditions(fulltextTransactionStateSearcher, query, removed);
}
IndexSearcher searcher = fulltextTransactionStateSearcher == null ? searcherRef.getSearcher() : new IndexSearcher(new MultiReader(searcherRef.getSearcher().getIndexReader(), fulltextTransactionStateSearcher.getIndexReader()));
IndexHits<Document> result;
if (additionalParametersOrNull != null && additionalParametersOrNull.getTop() > 0) {
result = new TopDocsIterator(query, additionalParametersOrNull, searcher);
} else {
Sort sorting = additionalParametersOrNull != null ? additionalParametersOrNull.getSorting() : null;
boolean forceScore = additionalParametersOrNull == null || !additionalParametersOrNull.getTradeCorrectnessForSpeed();
DocValuesCollector collector = new DocValuesCollector(forceScore);
searcher.search(query, collector);
return collector.getIndexHits(sorting);
}
return result;
}
use of org.neo4j.kernel.api.impl.index.collector.DocValuesCollector in project neo4j by neo4j.
the class LuceneLegacyIndex method letThroughAdditions.
private void letThroughAdditions(IndexSearcher additionsSearcher, Query query, Collection<EntityId> removed) throws IOException {
// This could be improved further by doing a term-dict lookup for every term in removed
// and retaining only those that did not match.
// This is getting quite low-level though
DocValuesCollector collector = new DocValuesCollector(false);
additionsSearcher.search(query, collector);
PrimitiveLongIterator valuesIterator = collector.getValuesIterator(KEY_DOC_ID);
LongCostume id = new LongCostume();
while (valuesIterator.hasNext()) {
long value = valuesIterator.next();
removed.remove(id.setId(value));
}
}
use of org.neo4j.kernel.api.impl.index.collector.DocValuesCollector in project neo4j by neo4j.
the class SimpleIndexReader method query.
protected PrimitiveLongIterator query(Query query) {
try {
DocValuesCollector docValuesCollector = new DocValuesCollector();
getIndexSearcher().search(query, docValuesCollector);
return docValuesCollector.getValuesIterator(NODE_ID_KEY);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Aggregations