public static void homogenizeIndexes ( final List < Value < ? > > list ) { if ( isIndexHomogeneous ( list ) ) return ; for ( int i = 0 ; i < list . size ( ) ; i ++ ) { final Value < ? > value = list . get ( i ) ; if ( value . excludeFromIndexes ( ) ) list . set ( i , index ( value , true ) ) ; } }
The datastore has a weird behavior of reordering values in a list so that indexed ones come before nonindexed ones . This can really mess up ordered lists . So if we find a heterogeneous list we need to force index everything .