Skip to content

Commit 7987e8c

Browse files
committed
Address more compile errors around TotalHitCountCollectorManager constructor
1 parent f8fac7a commit 7987e8c

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ public void testTranslogMultipleOperationsSameDocument() throws IOException {
640640
recoverFromTranslog(recoveringEngine, translogHandler, Long.MAX_VALUE);
641641
recoveringEngine.refresh("test");
642642
try (Engine.Searcher searcher = recoveringEngine.acquireSearcher("test")) {
643-
Integer totalHits = searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager());
643+
Integer totalHits = searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager(searcher.getSlices()));
644644
assertThat(totalHits, equalTo(operations.get(operations.size() - 1) instanceof Engine.Delete ? 0 : 1));
645645
}
646646
}
@@ -2010,7 +2010,7 @@ public void testConcurrentOutOfOrderDocsOnReplica() throws IOException, Interrup
20102010
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
20112011
Integer totalHits = searcher.search(
20122012
new TermQuery(new Term("value", lastFieldValueDoc1)),
2013-
new TotalHitCountCollectorManager()
2013+
new TotalHitCountCollectorManager(searcher.getSlices())
20142014
);
20152015
assertThat(totalHits, equalTo(1));
20162016
}
@@ -2019,7 +2019,7 @@ public void testConcurrentOutOfOrderDocsOnReplica() throws IOException, Interrup
20192019
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
20202020
Integer totalHits = searcher.search(
20212021
new TermQuery(new Term("value", lastFieldValueDoc2)),
2022-
new TotalHitCountCollectorManager()
2022+
new TotalHitCountCollectorManager(searcher.getSlices())
20232023
);
20242024
assertThat(totalHits, equalTo(1));
20252025
}
@@ -2249,7 +2249,7 @@ private int assertOpsOnPrimary(List<Engine.Operation> ops, long currentOpVersion
22492249
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
22502250
Integer totalHits = searcher.search(
22512251
new TermQuery(new Term("value", lastFieldValue)),
2252-
new TotalHitCountCollectorManager()
2252+
new TotalHitCountCollectorManager(searcher.getSlices())
22532253
);
22542254
assertThat(totalHits, equalTo(1));
22552255
}
@@ -2275,7 +2275,10 @@ private int assertOpsOnPrimary(List<Engine.Operation> ops, long currentOpVersion
22752275
assertVisibleCount(engine, docDeleted ? 0 : 1);
22762276
if (docDeleted == false) {
22772277
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
2278-
Integer totalHits = searcher.search(new TermQuery(new Term("value", lastFieldValue)), new TotalHitCountCollectorManager());
2278+
Integer totalHits = searcher.search(
2279+
new TermQuery(new Term("value", lastFieldValue)),
2280+
new TotalHitCountCollectorManager(searcher.getSlices())
2281+
);
22792282
assertThat(totalHits, equalTo(1));
22802283
}
22812284
}
@@ -2361,7 +2364,10 @@ public void testNonInternalVersioningOnPrimary() throws IOException {
23612364
if (docDeleted == false) {
23622365
logger.info("searching for [{}]", lastFieldValue);
23632366
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
2364-
Integer totalHits = searcher.search(new TermQuery(new Term("value", lastFieldValue)), new TotalHitCountCollectorManager());
2367+
Integer totalHits = searcher.search(
2368+
new TermQuery(new Term("value", lastFieldValue)),
2369+
new TotalHitCountCollectorManager(searcher.getSlices())
2370+
);
23652371
assertThat(totalHits, equalTo(1));
23662372
}
23672373
}
@@ -2378,7 +2384,7 @@ public void testVersioningPromotedReplica() throws IOException {
23782384
final int opsOnPrimary = assertOpsOnPrimary(primaryOps, finalReplicaVersion, deletedOnReplica, replicaEngine);
23792385
final long currentSeqNo = getSequenceID(replicaEngine, new Engine.Get(false, false, Term.toString(lastReplicaOp.uid()))).v1();
23802386
try (Engine.Searcher searcher = engine.acquireSearcher("test", Engine.SearcherScope.INTERNAL)) {
2381-
Integer totalHits = searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager());
2387+
Integer totalHits = searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager(searcher.getSlices()));
23822388
if (totalHits > 0) {
23832389
// last op wasn't delete
23842390
assertThat(currentSeqNo, equalTo(finalReplicaSeqNo + opsOnPrimary));
@@ -2402,7 +2408,10 @@ public void testConcurrentExternalVersioningOnPrimary() throws IOException, Inte
24022408
assertVisibleCount(engine, lastFieldValue == null ? 0 : 1);
24032409
if (lastFieldValue != null) {
24042410
try (Engine.Searcher searcher = engine.acquireSearcher("test")) {
2405-
Integer totalHits = searcher.search(new TermQuery(new Term("value", lastFieldValue)), new TotalHitCountCollectorManager());
2411+
Integer totalHits = searcher.search(
2412+
new TermQuery(new Term("value", lastFieldValue)),
2413+
new TotalHitCountCollectorManager(searcher.getSlices())
2414+
);
24062415
assertThat(totalHits, equalTo(1));
24072416
}
24082417
}

server/src/test/java/org/elasticsearch/search/SearchCancellationTests.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,17 @@ public void testCancellableCollector() throws IOException {
106106
true
107107
);
108108

109-
Integer totalHits = searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager());
109+
Integer totalHits = searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager(searcher.getSlices()));
110110
assertThat(totalHits, equalTo(reader.numDocs()));
111111

112112
searcher.addQueryCancellation(cancellation);
113-
expectThrows(TaskCancelledException.class, () -> searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager()));
113+
expectThrows(
114+
TaskCancelledException.class,
115+
() -> searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager(searcher.getSlices()))
116+
);
114117

115118
searcher.removeQueryCancellation(cancellation);
116-
Integer totalHits2 = searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager());
119+
Integer totalHits2 = searcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager(searcher.getSlices()));
117120
assertThat(totalHits2, equalTo(reader.numDocs()));
118121
}
119122

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/accesscontrol/SecurityIndexReaderWrapperIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ protected IndicesAccessControl getIndicesAccessControl() {
193193
int expectedHitCount = valuesHitCount[i];
194194
logger.info("Going to verify hit count with query [{}] with expected total hits [{}]", parsedQuery.query(), expectedHitCount);
195195

196-
Integer totalHits = indexSearcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager());
196+
Integer totalHits = indexSearcher.search(new MatchAllDocsQuery(), new TotalHitCountCollectorManager(indexSearcher.getSlices()));
197197
assertThat(totalHits, equalTo(expectedHitCount));
198198
assertThat(wrappedDirectoryReader.numDocs(), equalTo(expectedHitCount));
199199
}

0 commit comments

Comments
 (0)