Package org.apache.lucene.index.IndexReader

Examples of org.apache.lucene.index.IndexReader.InvertResult


    int i = readerIndex(docNumber);        // find segment num
    subReaders[i].getTermFreqVector(docNumber - starts[i], mapper);
  }
 
  public InvertResult invertScan(IndexSchema schema, InvertParams params)throws Exception{
    InvertResult rtn=new InvertResult();
    rtn.setParams(schema, params);
    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;
  }
View Full Code Here


    hasDeletions = false;
    numDocs = -1;                                 // invalidate cache
  }
 
  public InvertResult invertScan(IndexSchema schema, InvertParams params)throws Exception{
    InvertResult rtn=new InvertResult();
    rtn.setParams(schema, params);
    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;
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.IndexReader.InvertResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.