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


Java PackedInts.getReaderNoHeader方法代码示例

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


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

示例1: CompressingStoredFieldsIndexReader

import org.apache.lucene.util.packed.PackedInts; //导入方法依赖的package包/类
CompressingStoredFieldsIndexReader(IndexInput fieldsIndexIn, SegmentInfo si) throws IOException {
  maxDoc = si.getDocCount();
  int[] docBases = new int[16];
  long[] startPointers = new long[16];
  int[] avgChunkDocs = new int[16];
  long[] avgChunkSizes = new long[16];
  PackedInts.Reader[] docBasesDeltas = new PackedInts.Reader[16];
  PackedInts.Reader[] startPointersDeltas = new PackedInts.Reader[16];

  final int packedIntsVersion = fieldsIndexIn.readVInt();

  int blockCount = 0;

  for (;;) {
    final int numChunks = fieldsIndexIn.readVInt();
    if (numChunks == 0) {
      break;
    }
    if (blockCount == docBases.length) {
      final int newSize = ArrayUtil.oversize(blockCount + 1, 8);
      docBases = Arrays.copyOf(docBases, newSize);
      startPointers = Arrays.copyOf(startPointers, newSize);
      avgChunkDocs = Arrays.copyOf(avgChunkDocs, newSize);
      avgChunkSizes = Arrays.copyOf(avgChunkSizes, newSize);
      docBasesDeltas = Arrays.copyOf(docBasesDeltas, newSize);
      startPointersDeltas = Arrays.copyOf(startPointersDeltas, newSize);
    }

    // doc bases
    docBases[blockCount] = fieldsIndexIn.readVInt();
    avgChunkDocs[blockCount] = fieldsIndexIn.readVInt();
    final int bitsPerDocBase = fieldsIndexIn.readVInt();
    if (bitsPerDocBase > 32) {
      throw new CorruptIndexException("Corrupted bitsPerDocBase (resource=" + fieldsIndexIn + ")");
    }
    docBasesDeltas[blockCount] = PackedInts.getReaderNoHeader(fieldsIndexIn, PackedInts.Format.PACKED, packedIntsVersion, numChunks, bitsPerDocBase);

    // start pointers
    startPointers[blockCount] = fieldsIndexIn.readVLong();
    avgChunkSizes[blockCount] = fieldsIndexIn.readVLong();
    final int bitsPerStartPointer = fieldsIndexIn.readVInt();
    if (bitsPerStartPointer > 64) {
      throw new CorruptIndexException("Corrupted bitsPerStartPointer (resource=" + fieldsIndexIn + ")");
    }
    startPointersDeltas[blockCount] = PackedInts.getReaderNoHeader(fieldsIndexIn, PackedInts.Format.PACKED, packedIntsVersion, numChunks, bitsPerStartPointer);

    ++blockCount;
  }

  this.docBases = Arrays.copyOf(docBases, blockCount);
  this.startPointers = Arrays.copyOf(startPointers, blockCount);
  this.avgChunkDocs = Arrays.copyOf(avgChunkDocs, blockCount);
  this.avgChunkSizes = Arrays.copyOf(avgChunkSizes, blockCount);
  this.docBasesDeltas = Arrays.copyOf(docBasesDeltas, blockCount);
  this.startPointersDeltas = Arrays.copyOf(startPointersDeltas, blockCount);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:57,代码来源:CompressingStoredFieldsIndexReader.java

示例2: CompressingStoredFieldsIndexReader

import org.apache.lucene.util.packed.PackedInts; //导入方法依赖的package包/类
CompressingStoredFieldsIndexReader(IndexInput fieldsIndexIn, SegmentInfo si) throws IOException {
  this.fieldsIndexIn = fieldsIndexIn;
  maxDoc = si.getDocCount();
  int[] docBases = new int[16];
  long[] startPointers = new long[16];
  int[] avgChunkDocs = new int[16];
  long[] avgChunkSizes = new long[16];
  PackedInts.Reader[] docBasesDeltas = new PackedInts.Reader[16];
  PackedInts.Reader[] startPointersDeltas = new PackedInts.Reader[16];

  final int packedIntsVersion = fieldsIndexIn.readVInt();

  int blockCount = 0;

  for (;;) {
    final int numChunks = fieldsIndexIn.readVInt();
    if (numChunks == 0) {
      break;
    }
    if (blockCount == docBases.length) {
      final int newSize = ArrayUtil.oversize(blockCount + 1, 8);
      docBases = Arrays.copyOf(docBases, newSize);
      startPointers = Arrays.copyOf(startPointers, newSize);
      avgChunkDocs = Arrays.copyOf(avgChunkDocs, newSize);
      avgChunkSizes = Arrays.copyOf(avgChunkSizes, newSize);
      docBasesDeltas = Arrays.copyOf(docBasesDeltas, newSize);
      startPointersDeltas = Arrays.copyOf(startPointersDeltas, newSize);
    }

    // doc bases
    docBases[blockCount] = fieldsIndexIn.readVInt();
    avgChunkDocs[blockCount] = fieldsIndexIn.readVInt();
    final int bitsPerDocBase = fieldsIndexIn.readVInt();
    if (bitsPerDocBase > 32) {
      throw new CorruptIndexException("Corrupted");
    }
    docBasesDeltas[blockCount] = PackedInts.getReaderNoHeader(fieldsIndexIn, PackedInts.Format.PACKED, packedIntsVersion, numChunks, bitsPerDocBase);

    // start pointers
    startPointers[blockCount] = fieldsIndexIn.readVLong();
    avgChunkSizes[blockCount] = fieldsIndexIn.readVLong();
    final int bitsPerStartPointer = fieldsIndexIn.readVInt();
    if (bitsPerStartPointer > 64) {
      throw new CorruptIndexException("Corrupted");
    }
    startPointersDeltas[blockCount] = PackedInts.getReaderNoHeader(fieldsIndexIn, PackedInts.Format.PACKED, packedIntsVersion, numChunks, bitsPerStartPointer);

    ++blockCount;
  }

  this.docBases = Arrays.copyOf(docBases, blockCount);
  this.startPointers = Arrays.copyOf(startPointers, blockCount);
  this.avgChunkDocs = Arrays.copyOf(avgChunkDocs, blockCount);
  this.avgChunkSizes = Arrays.copyOf(avgChunkSizes, blockCount);
  this.docBasesDeltas = Arrays.copyOf(docBasesDeltas, blockCount);
  this.startPointersDeltas = Arrays.copyOf(startPointersDeltas, blockCount);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:58,代码来源:CompressingStoredFieldsIndexReader.java


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