Пример #1
0
 IntsReader(Directory dir, String id, int maxDoc, IOContext context, Type type)
     throws IOException {
   super(dir, id, CODEC_NAME, VERSION_CURRENT, maxDoc, context, type);
   arrayTemplate = DocValuesArraySource.forType(type);
   assert arrayTemplate != null;
   assert type == sizeToType(size);
 }
Пример #2
0
 @Override
 public Source load() throws IOException {
   final IndexInput indexInput = cloneData();
   try {
     return arrayTemplate.newFromInput(indexInput, maxDoc);
   } finally {
     IOUtils.close(indexInput);
   }
 }
Пример #3
0
 protected IntsWriter(
     Directory dir,
     String id,
     String codecName,
     int version,
     Counter bytesUsed,
     IOContext context,
     Type valueType) {
   super(dir, id, codecName, version, bytesUsed, context);
   size = typeToSize(valueType);
   this.bytesRef = new BytesRef(size);
   bytesRef.length = size;
   template = DocValuesArraySource.forType(valueType);
 }
Пример #4
0
 @Override
 protected boolean tryBulkMerge(DocValues docValues) {
   // only bulk merge if value type is the same otherwise size differs
   return super.tryBulkMerge(docValues) && docValues.getType() == template.getType();
 }
Пример #5
0
 @Override
 public void add(int docID, IndexableField value) throws IOException {
   template.toBytes(value.numericValue().longValue(), bytesRef);
   bytesSpareField.setBytesValue(bytesRef);
   super.add(docID, bytesSpareField);
 }
Пример #6
0
 @Override
 protected void setMergeBytes(Source source, int sourceDoc) {
   final long value = source.getInt(sourceDoc);
   template.toBytes(value, bytesRef);
 }