|
12 | 12 | import org.apache.lucene.index.LeafReader; |
13 | 13 | import org.apache.lucene.index.NoMergePolicy; |
14 | 14 | import org.apache.lucene.search.IndexSearcher; |
15 | | -import org.apache.lucene.search.MatchAllDocsQuery; |
16 | | -import org.apache.lucene.search.Sort; |
17 | | -import org.apache.lucene.search.SortField; |
18 | | -import org.apache.lucene.search.TopDocs; |
19 | 15 | import org.opensearch.Version; |
20 | 16 | import org.opensearch.common.lucene.uid.Versions; |
21 | 17 | import org.opensearch.common.unit.TimeValue; |
@@ -54,7 +50,6 @@ public void testReadOnlyEngineUsesLeafSorter() throws IOException { |
54 | 50 | store.associateIndexWithNewTranslog(translogUUID); |
55 | 51 | Comparator<LeafReader> leafSorter = Comparator.comparingInt(LeafReader::maxDoc); |
56 | 52 |
|
57 | | - // Use NoMergePolicy to prevent aggressive merging and ensure multiple segments |
58 | 53 | EngineConfig config = new EngineConfig.Builder().shardId(shardId) |
59 | 54 | .threadPool(threadPool) |
60 | 55 | .indexSettings(defaultSettings) |
@@ -322,22 +317,4 @@ public void testTimestampSortOptimizationWorksOnAllEngineTypes() throws IOExcept |
322 | 317 | } |
323 | 318 | } |
324 | 319 |
|
325 | | - private void testSortPerformance(Engine engine, String engineType) throws IOException { |
326 | | - try (Engine.Searcher searcher = engine.acquireSearcher("test", Engine.SearcherScope.EXTERNAL)) { |
327 | | - DirectoryReader reader = searcher.getDirectoryReader(); |
328 | | - IndexSearcher indexSearcher = new IndexSearcher(reader); |
329 | | - |
330 | | - // Create a sort by timestamp (descending) |
331 | | - Sort timestampSort = new Sort(new SortField("@timestamp", SortField.Type.LONG, true)); |
332 | | - |
333 | | - // Perform a sorted search |
334 | | - TopDocs topDocs = indexSearcher.search(new MatchAllDocsQuery(), 10, timestampSort); |
335 | | - |
336 | | - // Verify that the search completed successfully |
337 | | - assertThat("Search should complete successfully on " + engineType, topDocs.totalHits.value(), greaterThan(0L)); |
338 | | - |
339 | | - // Verify that the engine has leafSorter configured |
340 | | - assertThat("Engine " + engineType + " should have leafSorter configured", engine.config().getLeafSorter(), notNullValue()); |
341 | | - } |
342 | | - } |
343 | 320 | } |
0 commit comments