use of org.apache.lucene.search.MultiSearcher in project graphdb by neo4j-attic.
the class LuceneIndex method search.
private IndexHits<Document> search(IndexSearcherRef searcherRef, Query query, QueryContext additionalParametersOrNull, Searcher additionsSearcher, Collection<Long> removed) {
try {
if (additionsSearcher != null && !removed.isEmpty()) {
letThroughAdditions(additionsSearcher, query, removed);
}
Searcher searcher = additionsSearcher == null ? searcherRef.getSearcher() : new MultiSearcher(searcherRef.getSearcher(), additionsSearcher);
IndexHits<Document> result = null;
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();
Hits hits = new Hits(searcher, query, null, sorting, forceScore);
result = new HitsIterator(hits);
}
return result;
} catch (IOException e) {
throw new RuntimeException("Unable to query " + this + " with " + query, e);
}
}
Aggregations