Package org.apache.lucene.index

Examples of org.apache.lucene.index.SegmentInfoPerCommit


    LuceneSegmentInputSplit inputSplit = (LuceneSegmentInputSplit) split;

    Configuration configuration = context.getConfiguration();
    LuceneStorageConfiguration lucene2SeqConfiguration = new LuceneStorageConfiguration(configuration);

    SegmentInfoPerCommit segmentInfo = inputSplit.getSegment(configuration);
    segmentReader = new SegmentReader(segmentInfo, USE_TERM_INFO, IOContext.READ);


    IndexSearcher searcher = new IndexSearcher(segmentReader);
    Weight weight = lucene2SeqConfiguration.getQuery().createWeight(searcher);
View Full Code Here


    inputSplit.getSegment(configuration);
  }

  private void assertSegmentContainsOneDoc(String segmentName) throws IOException {
    LuceneSegmentInputSplit inputSplit = new LuceneSegmentInputSplit(indexPath1, segmentName, 1000);
    SegmentInfoPerCommit segment = inputSplit.getSegment(configuration);
    SegmentReader segmentReader = new SegmentReader(segment, 1, IOContext.READ);//SegmentReader.get(true, segment, 1);
    assertEquals(segmentName, segment.info.name);
    assertEquals(1, segmentReader.numDocs());
  }
View Full Code Here

  @Override
  protected void setup(Context context) throws IOException, InterruptedException {
    Configuration configuration = context.getConfiguration();
    l2sConf = new LuceneStorageConfiguration(configuration);
    LuceneSegmentInputSplit inputSplit = (LuceneSegmentInputSplit) context.getInputSplit();
    SegmentInfoPerCommit segmentInfo = inputSplit.getSegment(configuration);
    segmentReader = new SegmentReader(segmentInfo, LuceneSeqFileHelper.USE_TERM_INFOS, IOContext.READ);
  }
View Full Code Here

  public static void readLegacyInfos(SegmentInfos infos, Directory directory, IndexInput input, int format) throws IOException {
    infos.version = input.readLong(); // read version
    infos.counter = input.readInt(); // read counter
    Lucene3xSegmentInfoReader reader = new Lucene3xSegmentInfoReader();
    for (int i = input.readInt(); i > 0; i--) { // read segmentInfos
      SegmentInfoPerCommit siPerCommit = reader.readLegacySegmentInfo(directory, format, input);
      SegmentInfo si = siPerCommit.info;

      if (si.getVersion() == null) {
        // Could be a 3.0 - try to open the doc stores - if it fails, it's a
        // 2.x segment, and an IndexFormatTooOldException will be thrown,
View Full Code Here

    SegmentInfo info = new SegmentInfo(dir, version, name, docCount, isCompoundFile,
                                       null, diagnostics, Collections.unmodifiableMap(attributes));
    info.setFiles(files);

    SegmentInfoPerCommit infoPerCommit = new SegmentInfoPerCommit(info, delCount, delGen);
    return infoPerCommit;
  }
View Full Code Here

  @Override
  protected boolean isMerged(SegmentInfos infos, int maxNumSegments,
      Map<SegmentInfoPerCommit, Boolean> segmentsToOptimize) throws IOException {
    final int numSegments = infos.size();
    int numToOptimize = 0;
    SegmentInfoPerCommit optimizeInfo = null;
    for (int i = 0; i < numSegments && numToOptimize <= maxNumSegments; i++) {
      final SegmentInfoPerCommit info = infos.info(i);
      if (segmentsToOptimize.get(info)) {
        numToOptimize++;
        optimizeInfo = info;
      }
    }
View Full Code Here

      // Find the newest (rightmost) segment that needs to
      // be optimized (other segments may have been flushed
      // since optimize started):
      int last = infos.size();
      while (last > 0) {
        final SegmentInfoPerCommit info = infos.info(--last);
        if (segmentsToOptimize.get(info)) {
          last++;
          break;
        }
      }
View Full Code Here

      int mergeStart = i + prev;
      if ((mergeEnd - mergeStart) > 1) {
        spec.add(new OneMerge(infos.asList().subList(mergeStart, mergeEnd)));
      } else {
        if (partialExpunge) {
          SegmentInfoPerCommit info = infos.info(mergeStart);
          int delCount = info.getDelCount();
          if (delCount > maxDelCount) {
            expungeCandidate = mergeStart;
            maxDelCount = delCount;
          }
        }
View Full Code Here

      spec = super.findForcedDeletesMerges(smallSegments);
    }

    if (spec == null) spec = new MergeSpecification();
    for (int i = 0; i < numLargeSegs; i++) {
      SegmentInfoPerCommit info = infos.info(i);
      if (info.hasDeletions()) {
        spec.add(new OneMerge(infos.asList().subList(i, i + 1)));
      }
    }
    return spec;
  }
View Full Code Here

    if (numSegs <= numLargeSegs) return null;

    long totalLargeSegSize = 0;
    long totalSmallSegSize = 0;
    SegmentInfoPerCommit info;

    // compute the total size of large segments
    for (int i = 0; i < numLargeSegs; i++) {
      info = infos.info(i);
      totalLargeSegSize += size(info);
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.SegmentInfoPerCommit

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.