@@ -1090,7 +1090,8 @@ public void testMaxScore() throws Exception {
10901090
10911091 public void testMaxScoreWithSortOnScoreAndCollapsingResults () throws Exception {
10921092 Directory dir = newDirectory ();
1093- IndexWriterConfig iwc = newIndexWriterConfig ();
1093+ final Sort sort = new Sort (new SortField ("user" , SortField .Type .INT ));
1094+ IndexWriterConfig iwc = newIndexWriterConfig ().setIndexSort (sort );
10941095 RandomIndexWriter w = new RandomIndexWriter (random (), dir , iwc );
10951096
10961097 // Always end up with uneven buckets so collapsing is predictable
@@ -1130,8 +1131,8 @@ public void testMaxScoreWithSortOnScoreAndCollapsingResults() throws Exception {
11301131
11311132 assertThat (context .queryResult ().topDocs ().topDocs .scoreDocs [0 ].score , equalTo (context .queryResult ().getMaxScore ()));
11321133
1133- Sort sort = new Sort (new SortField (null , SortField .Type .SCORE ), new SortField (null , SortField .Type .DOC ));
1134- SortAndFormats sortAndFormats = new SortAndFormats (sort , new DocValueFormat [] { DocValueFormat .RAW , DocValueFormat .RAW });
1134+ Sort scoreSort = new Sort (new SortField (null , SortField .Type .SCORE ), new SortField (null , SortField .Type .DOC ));
1135+ SortAndFormats sortAndFormats = new SortAndFormats (scoreSort , new DocValueFormat [] { DocValueFormat .RAW , DocValueFormat .RAW });
11351136 context .sort (sortAndFormats );
11361137 QueryPhase .executeInternal (context .withCleanQueryResult (), queryPhaseSearcher );
11371138 assertFalse (Float .isNaN (context .queryResult ().getMaxScore ()));
0 commit comments