@@ -87,7 +87,7 @@ public class Hit<TDocument> implements JsonpSerializable {
87
87
88
88
private final Map <String , InnerHitsResult > innerHits ;
89
89
90
- private final List <String > matchedQueries ;
90
+ private final Map <String , Double > matchedQueries ;
91
91
92
92
@ Nullable
93
93
private final NestedIdentity nested ;
@@ -212,7 +212,7 @@ public final Map<String, InnerHitsResult> innerHits() {
212
212
/**
213
213
* API name: {@code matched_queries}
214
214
*/
215
- public final List <String > matchedQueries () {
215
+ public final Map <String , Double > matchedQueries () {
216
216
return this .matchedQueries ;
217
217
}
218
218
@@ -380,12 +380,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
380
380
}
381
381
if (ApiTypeHelper .isDefined (this .matchedQueries )) {
382
382
generator .writeKey ("matched_queries" );
383
- generator .writeStartArray ();
384
- for (String item0 : this .matchedQueries ) {
385
- generator .write (item0 );
383
+ if (this .matchedQueries .values ().stream ().allMatch (Objects ::isNull )) {
384
+ generator .writeStartArray ();
385
+ for (String item0 : this .matchedQueries .keySet ()) {
386
+ generator .write (item0 );
387
+ }
388
+ generator .writeEnd ();
389
+ } else {
390
+ generator .writeStartObject ();
391
+ for (Map .Entry <String , Double > item0 : this .matchedQueries .entrySet ()) {
392
+ generator .writeKey (item0 .getKey ());
393
+ generator .write (item0 .getValue ());
386
394
395
+ }
396
+ generator .writeEnd ();
387
397
}
388
- generator .writeEnd ();
389
398
390
399
}
391
400
if (this .nested != null ) {
@@ -509,7 +518,7 @@ public static class Builder<TDocument> extends WithJsonObjectBuilderBase<Builder
509
518
private Map <String , InnerHitsResult > innerHits ;
510
519
511
520
@ Nullable
512
- private List <String > matchedQueries ;
521
+ private Map <String , Double > matchedQueries ;
513
522
514
523
@ Nullable
515
524
private NestedIdentity nested ;
@@ -662,20 +671,20 @@ public final Builder<TDocument> innerHits(String key,
662
671
/**
663
672
* API name: {@code matched_queries}
664
673
* <p>
665
- * Adds all elements of <code>list </code> to <code>matchedQueries</code>.
674
+ * Adds all entries of <code>map </code> to <code>matchedQueries</code>.
666
675
*/
667
- public final Builder <TDocument > matchedQueries (List <String > list ) {
668
- this .matchedQueries = _listAddAll (this .matchedQueries , list );
676
+ public final Builder <TDocument > matchedQueries (Map <String , Double > map ) {
677
+ this .matchedQueries = _mapPutAll (this .matchedQueries , map );
669
678
return this ;
670
679
}
671
680
672
681
/**
673
682
* API name: {@code matched_queries}
674
683
* <p>
675
- * Adds one or more values to <code>matchedQueries</code>.
684
+ * Adds an entry to <code>matchedQueries</code>.
676
685
*/
677
- public final Builder <TDocument > matchedQueries (String value , String ... values ) {
678
- this .matchedQueries = _listAdd (this .matchedQueries , value , values );
686
+ public final Builder <TDocument > matchedQueries (String key , Double value ) {
687
+ this .matchedQueries = _mapPut (this .matchedQueries , key , value );
679
688
return this ;
680
689
}
681
690
@@ -937,7 +946,8 @@ protected static <TDocument> void setupHitDeserializer(ObjectDeserializer<Hit.Bu
937
946
JsonpDeserializer .arrayDeserializer (JsonpDeserializer .stringDeserializer ())), "highlight" );
938
947
op .add (Builder ::innerHits , JsonpDeserializer .stringMapDeserializer (InnerHitsResult ._DESERIALIZER ),
939
948
"inner_hits" );
940
- op .add (Builder ::matchedQueries , JsonpDeserializer .arrayDeserializer (JsonpDeserializer .stringDeserializer ()),
949
+ op .add (Builder ::matchedQueries ,
950
+ JsonpDeserializer .stringArrayMapUnionDeserializer (JsonpDeserializer .doubleDeserializer ()),
941
951
"matched_queries" );
942
952
op .add (Builder ::nested , NestedIdentity ._DESERIALIZER , "_nested" );
943
953
op .add (Builder ::ignored , JsonpDeserializer .arrayDeserializer (JsonpDeserializer .stringDeserializer ()),
0 commit comments