Search in sources :

Example 26 with Collector

use of org.apache.lucene.search.Collector in project crate by crate.

the class LuceneOrderedDocCollector method doSearch.

private KeyIterable<ShardId, Row> doSearch(TopFieldCollector topFieldCollector, Float minScore, Query query) throws IOException {
    Collector collector = topFieldCollector;
    if (minScore != null) {
        collector = new MinimumScoreCollector(collector, minScore);
    }
    collector = new KillableCollector(collector, this::raiseIfKilled);
    searcher.search(query, collector);
    ScoreDoc[] scoreDocs = topFieldCollector.topDocs().scoreDocs;
    if (doDocsScores) {
        TopFieldCollector.populateScores(scoreDocs, searcher, query);
    }
    return scoreDocToIterable(scoreDocs);
}
Also used : MinimumScoreCollector(org.elasticsearch.common.lucene.MinimumScoreCollector) LeafCollector(org.apache.lucene.search.LeafCollector) Collector(org.apache.lucene.search.Collector) MinimumScoreCollector(org.elasticsearch.common.lucene.MinimumScoreCollector) TopFieldCollector(org.apache.lucene.search.TopFieldCollector) ScoreDoc(org.apache.lucene.search.ScoreDoc)

Aggregations

Collector (org.apache.lucene.search.Collector)26 ArrayList (java.util.ArrayList)12 IndexSearcher (org.apache.lucene.search.IndexSearcher)11 Query (org.apache.lucene.search.Query)9 IOException (java.io.IOException)8 TopFieldCollector (org.apache.lucene.search.TopFieldCollector)8 LeafCollector (org.apache.lucene.search.LeafCollector)7 Sort (org.apache.lucene.search.Sort)7 Document (org.apache.lucene.document.Document)6 LeafReaderContext (org.apache.lucene.index.LeafReaderContext)6 MultiCollector (org.apache.lucene.search.MultiCollector)6 ScoreDoc (org.apache.lucene.search.ScoreDoc)6 BytesRef (org.apache.lucene.util.BytesRef)5 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 StringField (org.apache.lucene.document.StringField)4 BooleanQuery (org.apache.lucene.search.BooleanQuery)4 Directory (org.apache.lucene.store.Directory)4 List (java.util.List)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3