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


Java IndexInput.readVInt方法代码示例

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


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

示例1: scanTo

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
@Override
protected int scanTo(int target) throws IOException { 
  int docAcc = accum;
  int frq = 1;
  final IndexInput freqIn = this.freqIn;
  final boolean omitTF = indexOmitsTF;
  final int loopLimit = limit;
  for (int i = ord; i < loopLimit; i++) {
    int code = freqIn.readVInt();
    if (omitTF) {
      docAcc += code;
    } else {
      docAcc += code >>> 1; // shift off low bit
      frq = readFreq(freqIn, code);
    }
    if (docAcc >= target) {
      freq = frq;
      ord = i + 1;
      return accum = docAcc;
    }
  }
  ord = limit;
  freq = frq;
  accum = docAcc;
  return NO_MORE_DOCS;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:Lucene40PostingsReader.java

示例2: readSortedField

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readSortedField(int fieldNumber, IndexInput meta, FieldInfos infos) throws IOException {
  // sorted = binary + numeric
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene410DocValuesFormat.BINARY) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  BinaryEntry b = readBinaryEntry(meta);
  binaries.put(fieldNumber, b);
  
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene410DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sorted entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n = readNumericEntry(meta);
  ords.put(fieldNumber, n);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:Lucene410DocValuesProducer.java

示例3: CompressedIndexInput

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
public CompressedIndexInput(IndexInput in) throws IOException {
    super("compressed(" + in.toString() + ")");
    this.in = in;
    readHeader(in);
    this.version = in.readInt();
    long metaDataPosition = in.readLong();
    long headerLength = in.getFilePointer();
    in.seek(metaDataPosition);
    this.totalUncompressedLength = in.readVLong();
    int size = in.readVInt();
    offsets = BigArrays.NON_RECYCLING_INSTANCE.newLongArray(size);
    for (int i = 0; i < size; i++) {
        offsets.set(i, in.readVLong());
    }
    this.currentOffsetIdx = -1;
    this.currentUncompressedChunkPointer = 0;
    in.seek(headerLength);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:CompressedIndexInput.java

示例4: readFields

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readFields(IndexInput meta, FieldInfos infos) throws IOException {
  int fieldNumber = meta.readVInt();
  while (fieldNumber != -1) {
    FieldInfo info = infos.fieldInfo(fieldNumber);
    if (info == null) {
      throw new CorruptIndexException("Invalid field number: " + fieldNumber + " (resource=" + meta + ")");
    } else if (!info.hasNorms()) {
      throw new CorruptIndexException("Invalid field: " + info.name + " (resource=" + meta + ")");
    }
    NormsEntry entry = new NormsEntry();
    entry.format = meta.readByte();
    entry.offset = meta.readLong();
    switch(entry.format) {
      case CONST_COMPRESSED:
      case UNCOMPRESSED:
      case TABLE_COMPRESSED:
      case DELTA_COMPRESSED:
        break;
      default:
        throw new CorruptIndexException("Unknown format: " + entry.format + ", input=" + meta);
    }
    norms.put(fieldNumber, entry);
    fieldNumber = meta.readVInt();
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:Lucene49NormsProducer.java

示例5: readBytesRef

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private static BytesRef readBytesRef(IndexInput in) throws IOException {
  BytesRef bytes = new BytesRef();
  bytes.length = in.readVInt();
  bytes.bytes = new byte[bytes.length];
  in.readBytes(bytes.bytes, 0, bytes.length);
  return bytes;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:BlockTreeTermsReader.java

示例6: readFreq

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
final int readFreq(final IndexInput freqIn, final int code)
    throws IOException {
  if ((code & 1) != 0) { // if low bit is set
    return 1; // freq is one
  } else {
    return freqIn.readVInt(); // else read freq
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:Lucene40PostingsReader.java

示例7: fillDocs

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private final int fillDocs(int size) throws IOException {
  final IndexInput freqIn = this.freqIn;
  final int docs[] = this.docs;
  int docAc = accum;
  for (int i = 0; i < size; i++) {
    docAc += freqIn.readVInt();
    docs[i] = docAc;
  }
  accum = docAc;
  return size;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:Lucene40PostingsReader.java

示例8: fillDocsAndFreqs

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private final int fillDocsAndFreqs(int size) throws IOException {
  final IndexInput freqIn = this.freqIn;
  final int docs[] = this.docs;
  final int freqs[] = this.freqs;
  int docAc = accum;
  for (int i = 0; i < size; i++) {
    final int code = freqIn.readVInt();
    docAc += code >>> 1; // shift off low bit
    freqs[i] = readFreq(freqIn, code);
    docs[i] = docAc;
  }
  accum = docAc;
  return size;
 
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:Lucene40PostingsReader.java

示例9: nextUnreadDoc

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
@Override
protected final int nextUnreadDoc() throws IOException {
  int docAcc = accum;
  int frq = 1;
  final IndexInput freqIn = this.freqIn;
  final boolean omitTF = indexOmitsTF;
  final int loopLimit = limit;
  final Bits liveDocs = this.liveDocs;
  for (int i = ord; i < loopLimit; i++) {
    int code = freqIn.readVInt();
    if (omitTF) {
      docAcc += code;
    } else {
      docAcc += code >>> 1; // shift off low bit
      frq = readFreq(freqIn, code);
    }
    if (liveDocs.get(docAcc)) {
      freq = frq;
      ord = i + 1;
      return accum = docAcc;
    }
  }
  ord = limit;
  freq = frq;
  accum = docAcc;
  return NO_MORE_DOCS;
  
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:29,代码来源:Lucene40PostingsReader.java

示例10: readSortedSetEntry

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
SortedSetEntry readSortedSetEntry(IndexInput meta) throws IOException {
  SortedSetEntry entry = new SortedSetEntry();
  entry.format = meta.readVInt();
  if (entry.format != SORTED_SINGLE_VALUED && entry.format != SORTED_WITH_ADDRESSES) {
    throw new CorruptIndexException("Unknown format: " + entry.format + ", input=" + meta);
  }
  return entry;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:Lucene410DocValuesProducer.java

示例11: readSkipData

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
@Override
protected int readSkipData(int level, IndexInput skipStream) throws IOException {
  // if (DEBUG) {
  //   System.out.println("readSkipData level=" + level);
  // }
  int delta = skipStream.readVInt();
  // if (DEBUG) {
  //   System.out.println("  delta=" + delta);
  // }
  docPointer[level] += skipStream.readVInt();
  // if (DEBUG) {
  //   System.out.println("  docFP=" + docPointer[level]);
  // }

  if (posPointer != null) {
    posPointer[level] += skipStream.readVInt();
    // if (DEBUG) {
    //   System.out.println("  posFP=" + posPointer[level]);
    // }
    posBufferUpto[level] = skipStream.readVInt();
    // if (DEBUG) {
    //   System.out.println("  posBufferUpto=" + posBufferUpto[level]);
    // }

    if (payloadByteUpto != null) {
      payloadByteUpto[level] = skipStream.readVInt();
    }

    if (payPointer != null) {
      payPointer[level] += skipStream.readVInt();
    }
  }
  return delta;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:Lucene41SkipReader.java

示例12: readNumericEntry

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
static NumericEntry readNumericEntry(IndexInput meta) throws IOException {
  NumericEntry entry = new NumericEntry();
  entry.format = meta.readVInt();
  entry.missingOffset = meta.readLong();
  entry.offset = meta.readLong();
  entry.count = meta.readVLong();
  switch(entry.format) {
    case GCD_COMPRESSED:
      entry.minValue = meta.readLong();
      entry.gcd = meta.readLong();
      entry.bitsPerValue = meta.readVInt();
      break;
    case TABLE_COMPRESSED:
      final int uniqueValues = meta.readVInt();
      if (uniqueValues > 256) {
        throw new CorruptIndexException("TABLE_COMPRESSED cannot have more than 256 distinct values, input=" + meta);
      }
      entry.table = new long[uniqueValues];
      for (int i = 0; i < uniqueValues; ++i) {
        entry.table[i] = meta.readLong();
      }
      entry.bitsPerValue = meta.readVInt();
      break;
    case DELTA_COMPRESSED:
      entry.minValue = meta.readLong();
      entry.bitsPerValue = meta.readVInt();
      break;
    case MONOTONIC_COMPRESSED:
      entry.packedIntsVersion = meta.readVInt();
      entry.blockSize = meta.readVInt();
      break;
    default:
      throw new CorruptIndexException("Unknown format: " + entry.format + ", input=" + meta);
  }
  entry.endOffset = meta.readLong();
  return entry;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:38,代码来源:Lucene410DocValuesProducer.java

示例13: readBinaryEntry

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
static BinaryEntry readBinaryEntry(IndexInput meta) throws IOException {
  BinaryEntry entry = new BinaryEntry();
  entry.format = meta.readVInt();
  entry.missingOffset = meta.readLong();
  entry.minLength = meta.readVInt();
  entry.maxLength = meta.readVInt();
  entry.count = meta.readVLong();
  entry.offset = meta.readLong();
  switch(entry.format) {
    case BINARY_FIXED_UNCOMPRESSED:
      break;
    case BINARY_PREFIX_COMPRESSED:
      entry.addressInterval = meta.readVInt();
      entry.addressesOffset = meta.readLong();
      entry.packedIntsVersion = meta.readVInt();
      entry.blockSize = meta.readVInt();
      break;
    case BINARY_VARIABLE_UNCOMPRESSED:
      entry.addressesOffset = meta.readLong();
      entry.packedIntsVersion = meta.readVInt();
      entry.blockSize = meta.readVInt();
      break;
    default:
      throw new CorruptIndexException("Unknown format: " + entry.format + ", input=" + meta);
  }
  return entry;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:Lucene45DocValuesProducer.java

示例14: readSortedSetFieldWithAddresses

import org.apache.lucene.store.IndexInput; //导入方法依赖的package包/类
private void readSortedSetFieldWithAddresses(int fieldNumber, IndexInput meta, FieldInfos infos) throws IOException {
  // sortedset = binary + numeric (addresses) + ordIndex
  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene49DocValuesFormat.BINARY) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  BinaryEntry b = readBinaryEntry(meta);
  binaries.put(fieldNumber, b);

  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene49DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n1 = readNumericEntry(meta);
  ords.put(fieldNumber, n1);

  if (meta.readVInt() != fieldNumber) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  if (meta.readByte() != Lucene49DocValuesFormat.NUMERIC) {
    throw new CorruptIndexException("sortedset entry for field: " + fieldNumber + " is corrupt (resource=" + meta + ")");
  }
  NumericEntry n2 = readNumericEntry(meta);
  ordIndexes.put(fieldNumber, n2);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:Lucene49DocValuesProducer.java

示例15: CompressingStoredFieldsIndexReader

import org.apache.lucene.store.IndexInput; //导入方法依赖的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


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