Example usage for org.apache.solr.search BitDocSet BitDocSet

List of usage examples for org.apache.solr.search BitDocSet BitDocSet

Introduction

In this page you can find the example usage for org.apache.solr.search BitDocSet BitDocSet.

Prototype

public BitDocSet() 

Source Link

Usage

From source file:org.apache.lucene.index.DirectoryReader.java

License:Apache License

public InvertResult invertScan(IndexSchema schema, InvertParams params) throws Exception {
    InvertResult rtn = new InvertResult();
    rtn.setParams(schema, params);/*from ww  w.  jav  a2  s.c  o m*/
    DocSet docset = params.getDocset();
    DocSet[] subdocset = new DocSet[subReaders.length];
    if (subdocset.length == 1) {
        subdocset[0] = docset;
    } else {
        for (int i = 0; i < subReaders.length; i++) {
            subdocset[i] = new BitDocSet();
        }

        int index = 0;
        int end = this.getend(index);
        DocIterator iter = docset.iterator();
        while (iter.hasNext()) {
            int doc = iter.nextDoc();
            if (doc >= end) {
                index = this.readerIndex(doc);
                end = this.getend(index);
            }
            subdocset[index].add(doc - this.starts[index]);
        }

    }
    for (int i = 0; i < subReaders.length; i++) {
        params.setDocset(subdocset[i]);
        rtn.merge(subReaders[i].invertScan(schema, params));
    }
    return rtn;
}