Exemple #1
0
 @Override
 protected void doReadFrom(StreamInput in) throws IOException {
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) {
     this.docCountError = in.readLong();
   } else {
     this.docCountError = -1;
   }
   this.order = InternalOrder.Streams.readOrder(in);
   this.formatter = ValueFormatterStreams.readOptional(in);
   this.requiredSize = readSize(in);
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1)) {
     this.shardSize = readSize(in);
     this.showTermDocCountError = in.readBoolean();
   } else {
     this.shardSize = requiredSize;
     this.showTermDocCountError = false;
   }
   this.minDocCount = in.readVLong();
   if (in.getVersion().onOrAfter(Version.V_1_4_0)) {
     this.otherDocCount = in.readVLong();
   }
   int size = in.readVInt();
   List<InternalTerms.Bucket> buckets = new ArrayList<>(size);
   for (int i = 0; i < size; i++) {
     Bucket bucket = new Bucket(formatter, showTermDocCountError);
     bucket.readFrom(in);
     buckets.add(bucket);
   }
   this.buckets = buckets;
   this.bucketMap = null;
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   this.name = in.readString();
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta)) {
     this.docCountError = in.readLong();
   } else {
     this.docCountError = -1;
   }
   this.order = InternalOrder.Streams.readOrder(in);
   this.formatter = ValueFormatterStreams.readOptional(in);
   this.requiredSize = readSize(in);
   if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta)) {
     this.shardSize = readSize(in);
     this.showTermDocCountError = in.readBoolean();
   } else {
     this.shardSize = requiredSize;
     this.showTermDocCountError = false;
   }
   this.minDocCount = in.readVLong();
   int size = in.readVInt();
   List<InternalTerms.Bucket> buckets = new ArrayList<>(size);
   for (int i = 0; i < size; i++) {
     long term = in.readLong();
     long docCount = in.readVLong();
     long bucketDocCountError = -1;
     if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta) && showTermDocCountError) {
       bucketDocCountError = in.readLong();
     }
     InternalAggregations aggregations = InternalAggregations.readAggregations(in);
     buckets.add(
         new Bucket(term, docCount, aggregations, showTermDocCountError, bucketDocCountError));
   }
   this.buckets = buckets;
   this.bucketMap = null;
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   this.name = in.readString();
   this.order = InternalOrder.Streams.readOrder(in);
   this.valueFormatter = ValueFormatterStreams.readOptional(in);
   this.requiredSize = in.readVInt();
   int size = in.readVInt();
   List<InternalTerms.Bucket> buckets = new ArrayList<InternalTerms.Bucket>(size);
   for (int i = 0; i < size; i++) {
     buckets.add(
         new Bucket(in.readLong(), in.readVLong(), InternalAggregations.readAggregations(in)));
   }
   this.buckets = buckets;
   this.bucketMap = null;
 }
 @Override
 protected void doReadFrom(StreamInput in) throws IOException {
   this.docCountError = in.readLong();
   this.order = InternalOrder.Streams.readOrder(in);
   this.requiredSize = readSize(in);
   this.shardSize = readSize(in);
   this.showTermDocCountError = in.readBoolean();
   this.minDocCount = in.readVLong();
   this.otherDocCount = in.readVLong();
   int size = in.readVInt();
   List<InternalTerms.Bucket> buckets = new ArrayList<>(size);
   for (int i = 0; i < size; i++) {
     Bucket bucket = new Bucket(showTermDocCountError);
     bucket.readFrom(in);
     buckets.add(bucket);
   }
   this.buckets = buckets;
   this.bucketMap = null;
 }