Package org.apache.lucene.index

Examples of org.apache.lucene.index.NumericDocValues


    ramBytesUsed = new AtomicLong(RamUsageEstimator.shallowSizeOf(getClass()));
  }

  @Override
  public synchronized NumericDocValues getNumeric(FieldInfo field) throws IOException {
    NumericDocValues instance = numericInstances.get(field.number);
    if (instance == null) {
      String fileName = IndexFileNames.segmentFileName(state.segmentInfo.name + "_" + Integer.toString(field.number), segmentSuffix, "dat");
      IndexInput input = dir.openInput(fileName, state.context);
      boolean success = false;
      try {
View Full Code Here


      final long values[] = new long[maxDoc];
      for (int i = 0; i < values.length; i++) {
        values[i] = input.readLong();
      }
      ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
      return new NumericDocValues() {
        @Override
        public long get(int docID) {
          return values[docID];
        }
      };
    } else if (header == Lucene40DocValuesFormat.VAR_INTS_PACKED) {
      final long minValue = input.readLong();
      final long defaultValue = input.readLong();
      final PackedInts.Reader reader = PackedInts.getReader(input);
      ramBytesUsed.addAndGet(reader.ramBytesUsed());
      return new NumericDocValues() {
        @Override
        public long get(int docID) {
          final long value = reader.get(docID);
          if (value == defaultValue) {
            return 0;
View Full Code Here

    }
    int maxDoc = state.segmentInfo.getDocCount();
    final byte values[] = new byte[maxDoc];
    input.readBytes(values, 0, values.length);
    ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
    return new NumericDocValues() {
      @Override
      public long get(int docID) {
        return values[docID];
      }
    };
View Full Code Here

    final short values[] = new short[maxDoc];
    for (int i = 0; i < values.length; i++) {
      values[i] = input.readShort();
    }
    ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
    return new NumericDocValues() {
      @Override
      public long get(int docID) {
        return values[docID];
      }
    };
View Full Code Here

    final int values[] = new int[maxDoc];
    for (int i = 0; i < values.length; i++) {
      values[i] = input.readInt();
    }
    ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
    return new NumericDocValues() {
      @Override
      public long get(int docID) {
        return values[docID];
      }
    };
View Full Code Here

    final long values[] = new long[maxDoc];
    for (int i = 0; i < values.length; i++) {
      values[i] = input.readLong();
    }
    ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
    return new NumericDocValues() {
      @Override
      public long get(int docID) {
        return values[docID];
      }
    };
View Full Code Here

    final int values[] = new int[maxDoc];
    for (int i = 0; i < values.length; i++) {
      values[i] = input.readInt();
    }
    ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
    return new NumericDocValues() {
      @Override
      public long get(int docID) {
        return values[docID];
      }
    };
View Full Code Here

    final long values[] = new long[maxDoc];
    for (int i = 0; i < values.length; i++) {
      values[i] = input.readLong();
    }
    ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(values));
    return new NumericDocValues() {
      @Override
      public long get(int docID) {
        return values[docID];
      }
    };
View Full Code Here

        // we are done with this file
        if (file != singleNormStream) {
          openFiles.remove(file);
          file.close();
        }
        instance = new NumericDocValues() {
          @Override
          public long get(int docID) {
            return bytes[docID];
          }
        };
View Full Code Here

        }
        final int formatID = data.readVInt();
        final int bitsPerValue = data.readVInt();
        final PackedInts.Reader ordsReader = PackedInts.getReaderNoHeader(data, PackedInts.Format.byId(formatID), entry.packedIntsVersion, maxDoc, bitsPerValue);
        ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(decode) + ordsReader.ramBytesUsed());
        return new NumericDocValues() {
          @Override
          public long get(int docID) {
            return decode[(int)ordsReader.get(docID)];
          }
        };
      case DELTA_COMPRESSED:
        final int blockSize = data.readVInt();
        final BlockPackedReader reader = new BlockPackedReader(data, entry.packedIntsVersion, blockSize, maxDoc, false);
        ramBytesUsed.addAndGet(reader.ramBytesUsed());
        return reader;
      case UNCOMPRESSED:
        final byte bytes[] = new byte[maxDoc];
        data.readBytes(bytes, 0, bytes.length);
        ramBytesUsed.addAndGet(RamUsageEstimator.sizeOf(bytes));
        return new NumericDocValues() {
          @Override
          public long get(int docID) {
            return bytes[docID];
          }
        };
      case GCD_COMPRESSED:
        final long min = data.readLong();
        final long mult = data.readLong();
        final int quotientBlockSize = data.readVInt();
        final BlockPackedReader quotientReader = new BlockPackedReader(data, entry.packedIntsVersion, quotientBlockSize, maxDoc, false);
        ramBytesUsed.addAndGet(quotientReader.ramBytesUsed());
        return new NumericDocValues() {
          @Override
          public long get(int docID) {
            return min + mult * quotientReader.get(docID);
          }
        };
View Full Code Here

TOP

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

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.