File tree Expand file tree Collapse file tree 3 files changed +29
-11
lines changed
src/main/java/org/elasticsearch Expand file tree Collapse file tree 3 files changed +29
-11
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,18 @@ public String[] readStringArray() throws IOException {
335
335
return ret ;
336
336
}
337
337
338
+ public List <String > readStringList () throws IOException {
339
+ int size = readVInt ();
340
+ if (size == 0 ) {
341
+ return Collections .emptyList ();
342
+ }
343
+ List <String > ret = new ArrayList <>(size );
344
+ for (int i = 0 ; i < size ; i ++) {
345
+ ret .add (readString ());
346
+ }
347
+ return ret ;
348
+ }
349
+
338
350
@ Nullable
339
351
public Map <String , Object > readMap () throws IOException {
340
352
return (Map <String , Object >) readGenericValue ();
@@ -427,7 +439,7 @@ public int[] readIntArray() throws IOException {
427
439
}
428
440
return values ;
429
441
}
430
-
442
+
431
443
public long [] readLongArray () throws IOException {
432
444
int length = readVInt ();
433
445
long [] values = new long [length ];
@@ -436,7 +448,7 @@ public long[] readLongArray() throws IOException {
436
448
}
437
449
return values ;
438
450
}
439
-
451
+
440
452
public float [] readFloatArray () throws IOException {
441
453
int length = readVInt ();
442
454
float [] values = new float [length ];
@@ -445,7 +457,7 @@ public float[] readFloatArray() throws IOException {
445
457
}
446
458
return values ;
447
459
}
448
-
460
+
449
461
public double [] readDoubleArray () throws IOException {
450
462
int length = readVInt ();
451
463
double [] values = new double [length ];
Original file line number Diff line number Diff line change @@ -283,6 +283,13 @@ public void writeStringArray(String[] array) throws IOException {
283
283
}
284
284
}
285
285
286
+ public void writeStringList (List <String > stringList ) throws IOException {
287
+ writeVInt (stringList .size ());
288
+ for (String s : stringList ) {
289
+ writeString (s );
290
+ }
291
+ }
292
+
286
293
/**
287
294
* Writes a string array, for nullable string, writes it as 0 (empty string).
288
295
*/
@@ -399,21 +406,21 @@ public void writeIntArray(int[] value) throws IOException {
399
406
writeInt (value [i ]);
400
407
}
401
408
}
402
-
409
+
403
410
public void writeLongArray (long [] value ) throws IOException {
404
411
writeVInt (value .length );
405
412
for (int i =0 ; i <value .length ; i ++) {
406
413
writeLong (value [i ]);
407
414
}
408
415
}
409
-
416
+
410
417
public void writeFloatArray (float [] value ) throws IOException {
411
418
writeVInt (value .length );
412
419
for (int i =0 ; i <value .length ; i ++) {
413
420
writeFloat (value [i ]);
414
421
}
415
422
}
416
-
423
+
417
424
public void writeDoubleArray (double [] value ) throws IOException {
418
425
writeVInt (value .length );
419
426
for (int i =0 ; i <value .length ; i ++) {
Original file line number Diff line number Diff line change @@ -177,19 +177,18 @@ public QueryValidationException validate() {
177
177
return null ;
178
178
}
179
179
180
- @ SuppressWarnings ("unchecked" )
181
180
@ Override
182
181
public void readFrom (StreamInput in ) throws IOException {
183
- this .types = ( List < String >) in .readGenericValue ();
184
- this .ids = ( List < String >) in .readGenericValue ();
182
+ this .types = in .readStringList ();
183
+ this .ids = in .readStringList ();
185
184
queryName = in .readOptionalString ();
186
185
boost = in .readFloat ();
187
186
}
188
187
189
188
@ Override
190
189
public void writeTo (StreamOutput out ) throws IOException {
191
- out .writeGenericValue (this .types );
192
- out .writeGenericValue (this .ids );
190
+ out .writeStringList (this .types );
191
+ out .writeStringList (this .ids );
193
192
out .writeOptionalString (queryName );
194
193
out .writeFloat (boost );
195
194
}
You can’t perform that action at this time.
0 commit comments