@@ -49,10 +49,10 @@ public boolean preservesExactSource() {
4949
5050    @ Override 
5151    public  MapperTestCase .SyntheticSourceExample  example (int  maxValues ) {
52-         return  example (maxValues , false );
52+         return  example (maxValues , false ,  false );
5353    }
5454
55-     public  MapperTestCase .SyntheticSourceExample  example (int  maxValues , boolean  loadBlockFromSource ) {
55+     public  MapperTestCase .SyntheticSourceExample  example (int  maxValues , boolean  loadBlockFromSource ,  boolean   flipOrder ) {
5656        if  (ESTestCase .randomBoolean ()) {
5757            Tuple <String , String > v  = generateValue ();
5858            Object  sourceValue  = preservesExactSource () ? v .v1 () : v .v2 ();
@@ -77,7 +77,11 @@ public MapperTestCase.SyntheticSourceExample example(int maxValues, boolean load
7777            out  = in ;
7878        } else  {
7979            var  validValuesInCorrectOrder  = store  ? validValues  : outputFromDocValues ;
80-             var  syntheticSourceOutputList  = Stream .concat (validValuesInCorrectOrder .stream (), ignoredValues .stream ()).toList ();
80+             // this is an ugly little hack that flips the order of ignored values, which is important for the text-family fields where the 
81+             // ordering of produced synthetic source values can be different from what was supplied 
82+             var  syntheticSourceOutputList  = flipOrder 
83+                     ? Stream .concat (ignoredValues .stream (), validValuesInCorrectOrder .stream ()).toList ()
84+                     : Stream .concat (validValuesInCorrectOrder .stream (), ignoredValues .stream ()).toList ();
8185            out  = syntheticSourceOutputList .size () == 1  ? syntheticSourceOutputList .get (0 ) : syntheticSourceOutputList ;
8286        }
8387
0 commit comments