当前位置: 首页>>代码示例>>Java>>正文


Java IndexFileNames.fileNameFromGeneration方法代码示例

本文整理汇总了Java中org.apache.lucene.index.IndexFileNames.fileNameFromGeneration方法的典型用法代码示例。如果您正苦于以下问题:Java IndexFileNames.fileNameFromGeneration方法的具体用法?Java IndexFileNames.fileNameFromGeneration怎么用?Java IndexFileNames.fileNameFromGeneration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.index.IndexFileNames的用法示例。


在下文中一共展示了IndexFileNames.fileNameFromGeneration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readSegmentInfos

import org.apache.lucene.index.IndexFileNames; //导入方法依赖的package包/类
/**
 * Reads the segments infos from the given commit, failing if it fails to load
 */
public static SegmentInfos readSegmentInfos(IndexCommit commit) throws IOException {
    // Using commit.getSegmentsFileName() does NOT work here, have to
    // manually create the segment filename
    String filename = IndexFileNames.fileNameFromGeneration(IndexFileNames.SEGMENTS, "", commit.getGeneration());
    return SegmentInfos.readCommit(commit.getDirectory(), filename);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:Lucene.java

示例2: readLiveDocs

import org.apache.lucene.index.IndexFileNames; //导入方法依赖的package包/类
@Override
public Bits readLiveDocs(Directory dir, SegmentCommitInfo info, IOContext context) throws IOException {
  String filename = IndexFileNames.fileNameFromGeneration(info.info.name, DELETES_EXTENSION, info.getDelGen());
  final BitVector liveDocs = new BitVector(dir, filename, context);
  if (liveDocs.length() != info.info.getDocCount()) {
    throw new CorruptIndexException("liveDocs.length()=" + liveDocs.length() + "info.docCount=" + info.info.getDocCount() + " (filename=" + filename + ")");
  }
  if (liveDocs.count() != info.info.getDocCount() - info.getDelCount()) {
    throw new CorruptIndexException("liveDocs.count()=" + liveDocs.count() + " info.docCount=" + info.info.getDocCount() + " info.getDelCount()=" + info.getDelCount() + " (filename=" + filename + ")");
  }
  return liveDocs;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:Lucene40LiveDocsFormat.java

示例3: getNormFilename

import org.apache.lucene.index.IndexFileNames; //导入方法依赖的package包/类
private static String getNormFilename(SegmentInfo info, int number) {
  if (hasSeparateNorms(info, number)) {
    long gen = Long.parseLong(info.getAttribute(Lucene3xSegmentInfoFormat.NORMGEN_PREFIX + number));
    return IndexFileNames.fileNameFromGeneration(info.name, SEPARATE_NORMS_EXTENSION + number, gen);
  } else {
    // single file for all norms
    return IndexFileNames.segmentFileName(info.name, "", NORMS_EXTENSION);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:Lucene3xNormsProducer.java

示例4: writeLiveDocs

import org.apache.lucene.index.IndexFileNames; //导入方法依赖的package包/类
@Override
public void writeLiveDocs(MutableBits bits, Directory dir, SegmentCommitInfo info, int newDelCount, IOContext context) throws IOException {
  BitSet set = ((SimpleTextBits) bits).bits;
  int size = bits.length();
  BytesRefBuilder scratch = new BytesRefBuilder();
  
  String fileName = IndexFileNames.fileNameFromGeneration(info.info.name, LIVEDOCS_EXTENSION, info.getNextDelGen());
  IndexOutput out = null;
  boolean success = false;
  try {
    out = dir.createOutput(fileName, context);
    SimpleTextUtil.write(out, SIZE);
    SimpleTextUtil.write(out, Integer.toString(size), scratch);
    SimpleTextUtil.writeNewline(out);
    
    for (int i = set.nextSetBit(0); i >= 0; i=set.nextSetBit(i + 1)) { 
      SimpleTextUtil.write(out, DOC);
      SimpleTextUtil.write(out, Integer.toString(i), scratch);
      SimpleTextUtil.writeNewline(out);
    }
    
    SimpleTextUtil.write(out, END);
    SimpleTextUtil.writeNewline(out);
    SimpleTextUtil.writeChecksum(out, scratch);
    success = true;
  } finally {
    if (success) {
      IOUtils.close(out);
    } else {
      IOUtils.closeWhileHandlingException(out);
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:34,代码来源:SimpleTextLiveDocsFormat.java


注:本文中的org.apache.lucene.index.IndexFileNames.fileNameFromGeneration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。