@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 Bucket readResult(StreamInput in, BucketStreamContext context) throws IOException { Bucket buckets = new Bucket( context.formatter(), (boolean) context.attributes().get("showDocCountError")); buckets.readFrom(in); return buckets; }
@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; }
@Override public Bucket readResult(StreamInput in, BucketStreamContext context) throws IOException { Bucket buckets = new Bucket(context.keyed()); buckets.readFrom(in); return buckets; }