File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
core/src/test/java/org/elasticsearch/search/suggest/completion Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 3232
3333public class CompletionSuggestionTests extends ESTestCase {
3434
35- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/19896" )
3635 public void testToReduce () throws Exception {
3736 List <Suggest .Suggestion <CompletionSuggestion .Entry >> shardSuggestions = new ArrayList <>();
3837 int nShards = randomIntBetween (1 , 10 );
@@ -47,8 +46,11 @@ public void testToReduce() throws Exception {
4746 float maxScore = randomIntBetween (totalResults , totalResults *2 );
4847 for (int i = 0 ; i < totalResults ; i ++) {
4948 Suggest .Suggestion <CompletionSuggestion .Entry > suggestion = randomFrom (shardSuggestions );
50- suggestion .getEntries ().get (0 ).addOption (new CompletionSuggestion .Entry .Option (i , new Text ("" ),
51- maxScore - i , Collections .emptyMap ()));
49+ CompletionSuggestion .Entry entry = suggestion .getEntries ().get (0 );
50+ if (entry .getOptions ().size () < size ) {
51+ entry .addOption (new CompletionSuggestion .Entry .Option (i , new Text ("" ),
52+ maxScore - i , Collections .emptyMap ()));
53+ }
5254 }
5355 CompletionSuggestion reducedSuggestion = CompletionSuggestion .reduceTo (shardSuggestions );
5456 assertNotNull (reducedSuggestion );
You can’t perform that action at this time.
0 commit comments