Skip to content

Commit

Permalink
Fix the flaky test for derived fields highlighter test
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Maurya <rishabhmaurya05@gmail.com>
  • Loading branch information
rishabhmaurya committed Apr 19, 2024
1 parent b4692c8 commit 013bed0
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,17 @@ public void testDerivedFieldFromIndexMapping() throws IOException {

// create a fetch context to be used by HighlightPhase processor
FetchContext fetchContext = mock(FetchContext.class);
when(fetchContext.mapperService()).thenReturn(mockShardContext.getMapperService());
when(fetchContext.mapperService()).thenReturn(mapperService);
when(fetchContext.getQueryShardContext()).thenReturn(mockShardContext);
when(fetchContext.getIndexSettings()).thenReturn(indexService.getIndexSettings());
when(fetchContext.searcher()).thenReturn(
new ContextIndexSearcher(
searcher.getIndexReader(),
searcher.getSimilarity(),
searcher.getQueryCache(),
searcher.getQueryCachingPolicy(),
reader,
IndexSearcher.getDefaultSimilarity(),
IndexSearcher.getDefaultQueryCache(),
IndexSearcher.getDefaultQueryCachingPolicy(),
true,
searcher.getExecutor(),
null,
null
)
);
Expand Down Expand Up @@ -253,17 +253,17 @@ public void testDerivedFieldFromSearchMapping() throws IOException {

// create a fetch context to be used by HighlightPhase processor
FetchContext fetchContext = mock(FetchContext.class);
when(fetchContext.mapperService()).thenReturn(mockShardContext.getMapperService());
when(fetchContext.mapperService()).thenReturn(mapperService);
when(fetchContext.getQueryShardContext()).thenReturn(mockShardContext);
when(fetchContext.getIndexSettings()).thenReturn(indexService.getIndexSettings());
when(fetchContext.searcher()).thenReturn(
new ContextIndexSearcher(
searcher.getIndexReader(),
searcher.getSimilarity(),
searcher.getQueryCache(),
searcher.getQueryCachingPolicy(),
reader,
IndexSearcher.getDefaultSimilarity(),
IndexSearcher.getDefaultQueryCache(),
IndexSearcher.getDefaultQueryCachingPolicy(),
true,
searcher.getExecutor(),
null,
null
)
);
Expand Down

0 comments on commit 013bed0

Please sign in to comment.