[Upgrade] Lucene-9.2-snapshot (#2924)

This commit is contained in:
Nick Knize 2022-04-21 16:36:01 -05:00 committed by GitHub
parent 0cbd47c799
commit 3d49ccead2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
49 changed files with 125 additions and 63 deletions

View File

@ -1,5 +1,5 @@
opensearch = 3.0.0
lucene = 9.1.0
lucene = 9.2.0-snapshot-f4f1f70
bundled_jdk_vendor = adoptium
bundled_jdk = 17.0.2+8

View File

@ -1 +0,0 @@
2711abb758d101fc738c35a6867ee7559da5308b

View File

@ -0,0 +1 @@
f2a8008e74589f77f1d3da305cf58c88ee01d1c1

View File

@ -1 +0,0 @@
e9b429da553560fa0c363ffc04c774f957c56e14

View File

@ -0,0 +1 @@
f9569365e80897f1a9161254d5d2f44a44f95db8

View File

@ -1 +0,0 @@
b247f8a877237b4663e4ab7d86fae21c68a58ea5

View File

@ -0,0 +1 @@
35c14b39ff522dd6665e74a873035827b865075e

View File

@ -1 +0,0 @@
30e24b42fb0440911e702a531f4373bf397eb8c6

View File

@ -0,0 +1 @@
a84218a1ea0d5c52d6591d417061518b8a8be4e4

View File

@ -1 +0,0 @@
18a321d93836ea2856a5302d192e9dc99c647c6e

View File

@ -0,0 +1 @@
057bbd20b15899844b23d2cf034a167b4fe581f0

View File

@ -1 +0,0 @@
41c847f39a15bb8495be8c9d8a098974be15f74b

View File

@ -0,0 +1 @@
6a9a8d49e87b6999560a131e16234e46f21e6b42

View File

@ -1 +0,0 @@
ee7995231b181aa0a01f5aef8775562e269f5ef7

View File

@ -0,0 +1 @@
fcad3608779e0b3ab8703903b9d28cdc32767d60

View File

@ -1 +0,0 @@
575c458431396baa7f01a546173807f27b12a087

View File

@ -0,0 +1 @@
bd28479bdf3c076bc89a0d30864188d444410267

View File

@ -153,7 +153,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
QueryPhase.executeInternal(context.withCleanQueryResult().withProfilers(), queryPhaseSearcher);
assertEquals(1, context.queryResult().topDocs().topDocs.totalHits.value);
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -183,7 +185,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(query.getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("create_weight_count"), equalTo(1L));
}, (query) -> {
assertThat(query.getQueryName(), equalTo("MatchAllDocsQuery"));
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertThat(query.getQueryName(), equalTo("ConstantScoreQuery"));
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -265,7 +269,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
context.setTask(new SearchShardTask(123L, "", "", "", null, Collections.emptyMap()));
QueryPhase.executeInternal(context.withCleanQueryResult().withProfilers(), queryPhaseSearcher);
assertEquals(1, context.queryResult().topDocs().topDocs.totalHits.value);
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -413,7 +419,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertTrue(context.queryResult().terminatedEarly());
assertThat(context.queryResult().topDocs().topDocs.totalHits.value, equalTo(1L));
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(0));
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -489,27 +497,40 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(context.queryResult().topDocs().topDocs.totalHits.value, equalTo(1L));
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(0));
assertProfileData(context, "BooleanQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(query.getProfiledChildren(), hasSize(2));
assertThat(query.getProfiledChildren().get(0).getQueryName(), equalTo("TermQuery"));
// rewritten as a ConstantScoreQuery wrapping the original BooleanQuery
// see: https://github.com/apache/lucene/pull/672
assertThat(query.getProfiledChildren(), hasSize(1));
assertThat(query.getProfiledChildren().get(0).getQueryName(), equalTo("BooleanQuery"));
assertThat(query.getProfiledChildren().get(0).getTime(), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("score_count"), equalTo(0L));
assertThat(query.getProfiledChildren().get(1).getQueryName(), equalTo("TermQuery"));
assertThat(query.getProfiledChildren().get(1).getTime(), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("score_count"), equalTo(0L));
List<ProfileResult> children = query.getProfiledChildren().get(0).getProfiledChildren();
assertThat(children, hasSize(2));
assertThat(children.get(0).getQueryName(), equalTo("TermQuery"));
assertThat(children.get(0).getTime(), greaterThan(0L));
assertThat(children.get(0).getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(children.get(0).getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(children.get(0).getTimeBreakdown().get("score"), equalTo(0L));
assertThat(children.get(0).getTimeBreakdown().get("score_count"), equalTo(0L));
assertThat(children.get(1).getQueryName(), equalTo("TermQuery"));
assertThat(children.get(1).getTime(), greaterThan(0L));
assertThat(children.get(1).getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(children.get(1).getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(children.get(1).getTimeBreakdown().get("score"), equalTo(0L));
assertThat(children.get(1).getTimeBreakdown().get("score_count"), equalTo(0L));
}, collector -> {
assertThat(collector.getReason(), equalTo("search_terminate_after_count"));
assertThat(collector.getTime(), greaterThan(0L));
@ -597,7 +618,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(context.queryResult().topDocs().topDocs.scoreDocs[0], instanceOf(FieldDoc.class));
FieldDoc fieldDoc = (FieldDoc) context.queryResult().topDocs().topDocs.scoreDocs[0];
assertThat(fieldDoc.fields[0], equalTo(1));
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -631,7 +654,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(query.getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("create_weight_count"), equalTo(1L));
}, (query) -> {
assertThat(query.getQueryName(), equalTo("MatchAllDocsQuery"));
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertThat(query.getQueryName(), equalTo("ConstantScoreQuery"));
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -649,7 +674,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(1));
assertThat(context.queryResult().topDocs().topDocs.scoreDocs[0], instanceOf(FieldDoc.class));
assertThat(fieldDoc.fields[0], anyOf(equalTo(1), equalTo(2)));
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -666,7 +693,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(1));
assertThat(context.queryResult().topDocs().topDocs.scoreDocs[0], instanceOf(FieldDoc.class));
assertThat(fieldDoc.fields[0], anyOf(equalTo(1), equalTo(2)));
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -721,7 +750,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertNull(context.queryResult().terminatedEarly());
assertThat(context.terminateAfter(), equalTo(0));
assertThat(context.queryResult().getTotalHits().value, equalTo((long) numDocs));
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -829,7 +860,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertEquals(numDocs / 2, context.queryResult().topDocs().topDocs.totalHits.value);
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(3));
assertEquals(context.queryResult().topDocs().topDocs.totalHits.relation, TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO);
assertProfileData(context, "SpanNearQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));

View File

@ -1 +0,0 @@
240e3997fb139ff001e022124c89b686b5a8498d

View File

@ -0,0 +1 @@
1f7c4b91c8ef9f65e85c5190080b3f796076f355

View File

@ -1 +0,0 @@
de23bdacb09e8b39cbe876ff79c7a5b2ecc1faa6

View File

@ -0,0 +1 @@
e3ee195405dc0cb249fe2eb3f3a6a848c4686645

View File

@ -1 +0,0 @@
0375603f1dacd8266526404faf0088a2ac8ec2ff

View File

@ -0,0 +1 @@
f1cb45d20f7f23c420c56a94e9153e96bfdd6e1f

View File

@ -1 +0,0 @@
703308505e62fa7dcb0bf64fdb6d95d335941bdc

View File

@ -0,0 +1 @@
29052ac8f5255c8df2bb1d3d0da94e112c181679

View File

@ -1 +0,0 @@
7f1925f6ef985000399a277ca17b8f67d3056838

View File

@ -0,0 +1 @@
d710569c00d561c70d8290de4c4c15fe9735f94f

View File

@ -1 +0,0 @@
e7d39da8e623c99ee8da8bcc0185b2d908aca4b3

View File

@ -0,0 +1 @@
0f3081b32664d8ca6318e69dd054befb5f9a334b

View File

@ -1 +0,0 @@
209166fd48dae3261ccf26990fe600332b8fb373

View File

@ -0,0 +1 @@
81b63e23b87c054c140ff6a1e2e6696ca750d51c

View File

@ -1 +0,0 @@
905d93b6389060cf4b0cb464ffa8fa2db81b60e7

View File

@ -0,0 +1 @@
0cdea200c1890b877d26ce58b7d797f122bb8328

View File

@ -1 +0,0 @@
c50fc971573910ea239ee6f275e9257b6b6bdd48

View File

@ -0,0 +1 @@
50d8395e3afc502f267cb308399ab783edfabec0

View File

@ -1 +0,0 @@
383eb69b12f9d9c98c44237155f50c870c9a34b9

View File

@ -0,0 +1 @@
815b394c8be5cbb9673011953da38d39a843b0fa

View File

@ -1 +0,0 @@
0c728684e750a63f881998fbe27afd897f739762

View File

@ -0,0 +1 @@
7bb7c539172dc3513d4f34e7f29d2cd3a0352361

View File

@ -1 +0,0 @@
94d7d107c399cd11d407b94fa62f5677fe86f63b

View File

@ -0,0 +1 @@
7bc2f2e37f866e3b376f083e4b7cc89a8cb45fd0

View File

@ -1 +0,0 @@
7717b300bc14dfa9eb4b7d5970d8e25a60010e64

View File

@ -0,0 +1 @@
a5f79bb1f8337dbe6fc50fc5abd46d4eaaf4d433

View File

@ -1 +0,0 @@
957fca507eba94dbc3ef0d02377839be49bbe619

View File

@ -0,0 +1 @@
9e74f66171ea215e8c4936588381c0950c290c80

View File

@ -83,7 +83,7 @@ public class Version implements Comparable<Version>, ToXContentFragment {
public static final Version V_1_3_2 = new Version(1030299, org.apache.lucene.util.Version.LUCENE_8_10_1);
public static final Version V_2_0_0 = new Version(2000099, org.apache.lucene.util.Version.LUCENE_9_1_0);
public static final Version V_2_1_0 = new Version(2010099, org.apache.lucene.util.Version.LUCENE_9_1_0);
public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_9_1_0);
public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_9_2_0);
public static final Version CURRENT = V_3_0_0;
public static Version readVersion(StreamInput in) throws IOException {

View File

@ -224,7 +224,7 @@ public class VersionsTests extends OpenSearchTestCase {
assertEquals(VersionUtils.getFirstVersion().luceneVersion.major - 1, version.luceneVersion.major);
// future version, should be the same version as today
version = Version.fromString("2.77.1");
version = Version.fromString(Version.CURRENT.major + ".77.1");
assertEquals(Version.CURRENT.luceneVersion, version.luceneVersion);
}
}

View File

@ -127,7 +127,7 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
QueryPhase.executeInternal(context.withCleanQueryResult().withProfilers());
assertEquals(1, context.queryResult().topDocs().topDocs.totalHits.value);
assertProfileData(context, "MatchAllDocsQuery", query -> {
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -157,7 +157,7 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(query.getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("create_weight_count"), equalTo(1L));
}, (query) -> {
assertThat(query.getQueryName(), equalTo("MatchAllDocsQuery"));
assertThat(query.getQueryName(), equalTo("ConstantScoreQuery"));
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -239,7 +239,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
context.setTask(new SearchShardTask(123L, "", "", "", null, Collections.emptyMap()));
QueryPhase.executeInternal(context.withCleanQueryResult().withProfilers());
assertEquals(1, context.queryResult().topDocs().topDocs.totalHits.value);
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -387,7 +389,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertTrue(context.queryResult().terminatedEarly());
assertThat(context.queryResult().topDocs().topDocs.totalHits.value, equalTo(1L));
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(0));
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -463,27 +467,40 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(context.queryResult().topDocs().topDocs.totalHits.value, equalTo(1L));
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(0));
assertProfileData(context, "BooleanQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(query.getProfiledChildren(), hasSize(2));
assertThat(query.getProfiledChildren().get(0).getQueryName(), equalTo("TermQuery"));
// rewritten as a ConstantScoreQuery wrapping the original BooleanQuery
// see: https://github.com/apache/lucene/pull/672
assertThat(query.getProfiledChildren(), hasSize(1));
assertThat(query.getProfiledChildren().get(0).getQueryName(), equalTo("BooleanQuery"));
assertThat(query.getProfiledChildren().get(0).getTime(), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getProfiledChildren().get(0).getTimeBreakdown().get("score_count"), equalTo(0L));
assertThat(query.getProfiledChildren().get(1).getQueryName(), equalTo("TermQuery"));
assertThat(query.getProfiledChildren().get(1).getTime(), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getProfiledChildren().get(1).getTimeBreakdown().get("score_count"), equalTo(0L));
List<ProfileResult> children = query.getProfiledChildren().get(0).getProfiledChildren();
assertThat(children, hasSize(2));
assertThat(children.get(0).getQueryName(), equalTo("TermQuery"));
assertThat(children.get(0).getTime(), greaterThan(0L));
assertThat(children.get(0).getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(children.get(0).getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(children.get(0).getTimeBreakdown().get("score"), equalTo(0L));
assertThat(children.get(0).getTimeBreakdown().get("score_count"), equalTo(0L));
assertThat(children.get(1).getQueryName(), equalTo("TermQuery"));
assertThat(children.get(1).getTime(), greaterThan(0L));
assertThat(children.get(1).getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(children.get(1).getTimeBreakdown().get("create_weight_count"), equalTo(1L));
assertThat(children.get(1).getTimeBreakdown().get("score"), equalTo(0L));
assertThat(children.get(1).getTimeBreakdown().get("score_count"), equalTo(0L));
}, collector -> {
assertThat(collector.getReason(), equalTo("search_terminate_after_count"));
assertThat(collector.getTime(), greaterThan(0L));
@ -571,7 +588,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(context.queryResult().topDocs().topDocs.scoreDocs[0], instanceOf(FieldDoc.class));
FieldDoc fieldDoc = (FieldDoc) context.queryResult().topDocs().topDocs.scoreDocs[0];
assertThat(fieldDoc.fields[0], equalTo(1));
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -605,7 +624,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(query.getTimeBreakdown().get("create_weight"), greaterThan(0L));
assertThat(query.getTimeBreakdown().get("create_weight_count"), equalTo(1L));
}, (query) -> {
assertThat(query.getQueryName(), equalTo("MatchAllDocsQuery"));
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertThat(query.getQueryName(), equalTo("ConstantScoreQuery"));
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -623,7 +644,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(1));
assertThat(context.queryResult().topDocs().topDocs.scoreDocs[0], instanceOf(FieldDoc.class));
assertThat(fieldDoc.fields[0], anyOf(equalTo(1), equalTo(2)));
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -640,7 +663,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(1));
assertThat(context.queryResult().topDocs().topDocs.scoreDocs[0], instanceOf(FieldDoc.class));
assertThat(fieldDoc.fields[0], anyOf(equalTo(1), equalTo(2)));
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -695,7 +720,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertNull(context.queryResult().terminatedEarly());
assertThat(context.terminateAfter(), equalTo(0));
assertThat(context.queryResult().getTotalHits().value, equalTo((long) numDocs));
assertProfileData(context, "MatchAllDocsQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));
@ -806,7 +833,9 @@ public class QueryProfilePhaseTests extends IndexShardTestCase {
assertEquals(numDocs / 2, context.queryResult().topDocs().topDocs.totalHits.value);
assertThat(context.queryResult().topDocs().topDocs.scoreDocs.length, equalTo(3));
assertEquals(context.queryResult().topDocs().topDocs.totalHits.relation, TotalHits.Relation.GREATER_THAN_OR_EQUAL_TO);
assertProfileData(context, "SpanNearQuery", query -> {
// IndexSearcher#rewrite optimizes by rewriting non-scoring queries to ConstantScoreQuery
// see: https://github.com/apache/lucene/pull/672
assertProfileData(context, "ConstantScoreQuery", query -> {
assertThat(query.getTimeBreakdown().keySet(), not(empty()));
assertThat(query.getTimeBreakdown().get("score"), equalTo(0L));
assertThat(query.getTimeBreakdown().get("score_count"), equalTo(0L));