Example usage for org.apache.lucene.search CollectorManager newCollector

List of usage examples for org.apache.lucene.search CollectorManager newCollector

Introduction

In this page you can find the example usage for org.apache.lucene.search CollectorManager newCollector.

Prototype

C newCollector() throws IOException;

Source Link

Document

Return a new Collector .

Usage

From source file:com.lucene.MyIndexSearcher.java

License:Apache License

public <C extends Collector, T> T search(Query query, CollectorManager<C, T> collectorManager)
        throws IOException {
    final C collector = collectorManager.newCollector();
    search(query, collector);/*from  w  w w  .j a  v a  2s  .c  o  m*/
    List<C> co = Collections.singletonList(collector);
    T coll = collectorManager.reduce(co);
    return coll;
}