From 5c4b0ef36370b8fd5bef05f5bd16db0b383303a2 Mon Sep 17 00:00:00 2001 From: jimczi Date: Mon, 8 Apr 2019 13:47:15 +0200 Subject: [PATCH 1/5] upgrade to Lucene 8.1.0-snapshot-e460356abe --- buildSrc/version.properties | 2 +- .../licenses/lucene-expressions-8.0.0.jar.sha1 | 1 - ...ne-expressions-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + .../licenses/lucene-analyzers-icu-8.0.0.jar.sha1 | 1 - ...-analyzers-icu-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + .../lucene-analyzers-kuromoji-8.0.0.jar.sha1 | 1 - ...yzers-kuromoji-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + .../licenses/lucene-analyzers-nori-8.0.0.jar.sha1 | 1 - ...analyzers-nori-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + .../lucene-analyzers-phonetic-8.0.0.jar.sha1 | 1 - ...yzers-phonetic-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + .../licenses/lucene-analyzers-smartcn-8.0.0.jar.sha1 | 1 - ...lyzers-smartcn-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + .../licenses/lucene-analyzers-stempel-8.0.0.jar.sha1 | 1 - ...lyzers-stempel-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + .../lucene-analyzers-morfologik-8.0.0.jar.sha1 | 1 - ...ers-morfologik-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + .../licenses/lucene-analyzers-common-8.0.0.jar.sha1 | 1 - ...alyzers-common-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + .../licenses/lucene-backward-codecs-8.0.0.jar.sha1 | 1 - ...ackward-codecs-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-core-8.0.0.jar.sha1 | 1 - .../lucene-core-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-grouping-8.0.0.jar.sha1 | 1 - ...ucene-grouping-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-highlighter-8.0.0.jar.sha1 | 1 - ...ne-highlighter-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-join-8.0.0.jar.sha1 | 1 - .../lucene-join-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-memory-8.0.0.jar.sha1 | 1 - .../lucene-memory-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-misc-8.0.0.jar.sha1 | 1 - .../lucene-misc-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-queries-8.0.0.jar.sha1 | 1 - ...lucene-queries-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-queryparser-8.0.0.jar.sha1 | 1 - ...ne-queryparser-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-sandbox-8.0.0.jar.sha1 | 1 - ...lucene-sandbox-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-spatial-8.0.0.jar.sha1 | 1 - ...lucene-spatial-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-spatial-extras-8.0.0.jar.sha1 | 1 - ...spatial-extras-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-spatial3d-8.0.0.jar.sha1 | 1 - ...cene-spatial3d-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + server/licenses/lucene-suggest-8.0.0.jar.sha1 | 1 - ...lucene-suggest-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + .../search/uhighlight/CustomUnifiedHighlighter.java | 5 ----- server/src/main/java/org/elasticsearch/Version.java | 2 +- .../org/elasticsearch/index/codec/CodecService.java | 3 ++- .../codec/PerFieldMappingPostingFormatCodec.java | 3 ++- .../elasticsearch/index/query/IntervalBuilder.java | 12 ++++++++---- .../sql-action/licenses/lucene-core-8.0.0.jar.sha1 | 1 - .../lucene-core-8.1.0-snapshot-e460356abe.jar.sha1 | 1 + 54 files changed, 38 insertions(+), 37 deletions(-) delete mode 100644 modules/lang-expression/licenses/lucene-expressions-8.0.0.jar.sha1 create mode 100644 modules/lang-expression/licenses/lucene-expressions-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 plugins/analysis-icu/licenses/lucene-analyzers-icu-8.0.0.jar.sha1 create mode 100644 plugins/analysis-icu/licenses/lucene-analyzers-icu-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.0.0.jar.sha1 create mode 100644 plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 plugins/analysis-nori/licenses/lucene-analyzers-nori-8.0.0.jar.sha1 create mode 100644 plugins/analysis-nori/licenses/lucene-analyzers-nori-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.0.0.jar.sha1 create mode 100644 plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.0.0.jar.sha1 create mode 100644 plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.0.0.jar.sha1 create mode 100644 plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.0.0.jar.sha1 create mode 100644 plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-analyzers-common-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-analyzers-common-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-backward-codecs-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-backward-codecs-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-core-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-core-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-grouping-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-grouping-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-highlighter-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-highlighter-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-join-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-join-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-memory-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-memory-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-misc-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-misc-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-queries-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-queries-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-queryparser-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-queryparser-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-sandbox-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-sandbox-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-spatial-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-spatial-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-spatial-extras-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-spatial-extras-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-spatial3d-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-spatial3d-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 server/licenses/lucene-suggest-8.0.0.jar.sha1 create mode 100644 server/licenses/lucene-suggest-8.1.0-snapshot-e460356abe.jar.sha1 delete mode 100644 x-pack/plugin/sql/sql-action/licenses/lucene-core-8.0.0.jar.sha1 create mode 100644 x-pack/plugin/sql/sql-action/licenses/lucene-core-8.1.0-snapshot-e460356abe.jar.sha1 diff --git a/buildSrc/version.properties b/buildSrc/version.properties index d4ad364f2030b..c723cb1c9e514 100644 --- a/buildSrc/version.properties +++ b/buildSrc/version.properties @@ -1,5 +1,5 @@ elasticsearch = 8.0.0 -lucene = 8.0.0 +lucene = 8.1.0-snapshot-e460356abe bundled_jdk = 12+33 diff --git a/modules/lang-expression/licenses/lucene-expressions-8.0.0.jar.sha1 b/modules/lang-expression/licenses/lucene-expressions-8.0.0.jar.sha1 deleted file mode 100644 index 6174d2bce6456..0000000000000 --- a/modules/lang-expression/licenses/lucene-expressions-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -106b35cf2739f7d2350f3ef5c107d9d066d17cd6 \ No newline at end of file diff --git a/modules/lang-expression/licenses/lucene-expressions-8.1.0-snapshot-e460356abe.jar.sha1 b/modules/lang-expression/licenses/lucene-expressions-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..48446e877e309 --- /dev/null +++ b/modules/lang-expression/licenses/lucene-expressions-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +0a1addebde14147501b7d24a581a7a7288bc585d \ No newline at end of file diff --git a/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.0.0.jar.sha1 b/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.0.0.jar.sha1 deleted file mode 100644 index 51bd478ce4cf1..0000000000000 --- a/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -1bc195d1b036b59cdf7704f758df8f43c7e229c4 \ No newline at end of file diff --git a/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.1.0-snapshot-e460356abe.jar.sha1 b/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..c03380c6cf36c --- /dev/null +++ b/plugins/analysis-icu/licenses/lucene-analyzers-icu-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +b8b7d744e6294706b379ec7fdd2d6f1b6badc95b \ No newline at end of file diff --git a/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.0.0.jar.sha1 b/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.0.0.jar.sha1 deleted file mode 100644 index 6c60a7f069a22..0000000000000 --- a/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -760d9451396c45fdb271750f4e52acc2ff5e7bb2 \ No newline at end of file diff --git a/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.1.0-snapshot-e460356abe.jar.sha1 b/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..e3195509e493f --- /dev/null +++ b/plugins/analysis-kuromoji/licenses/lucene-analyzers-kuromoji-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +c9dcc5568ccd4589f4a6871d2019661546106c83 \ No newline at end of file diff --git a/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.0.0.jar.sha1 b/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.0.0.jar.sha1 deleted file mode 100644 index e52dfa93565a1..0000000000000 --- a/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -5bb5a241d95d9753a5e9fb341476306cb96a34a9 \ No newline at end of file diff --git a/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.1.0-snapshot-e460356abe.jar.sha1 b/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..77cd0b32ed9ea --- /dev/null +++ b/plugins/analysis-nori/licenses/lucene-analyzers-nori-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +bef6d901a9c8b4c6139de7419b3024e0c9fd4ad3 \ No newline at end of file diff --git a/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.0.0.jar.sha1 b/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.0.0.jar.sha1 deleted file mode 100644 index f802e93d17027..0000000000000 --- a/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -e3384e1b5c1e5f39026d3d6e48e00df84f614911 \ No newline at end of file diff --git a/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.1.0-snapshot-e460356abe.jar.sha1 b/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..1f090e9ca523f --- /dev/null +++ b/plugins/analysis-phonetic/licenses/lucene-analyzers-phonetic-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +074c06d6f2254edae04acdd53bf6989a4343acc8 \ No newline at end of file diff --git a/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.0.0.jar.sha1 b/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.0.0.jar.sha1 deleted file mode 100644 index 0c427cb38be75..0000000000000 --- a/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -3e413379d7e61eb43dee64ec5e756cbeb3478a05 \ No newline at end of file diff --git a/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.1.0-snapshot-e460356abe.jar.sha1 b/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..42a1e22cdfbc0 --- /dev/null +++ b/plugins/analysis-smartcn/licenses/lucene-analyzers-smartcn-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +5cd2a341ab4524ec7ff40ba29faa4ead5e805413 \ No newline at end of file diff --git a/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.0.0.jar.sha1 b/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.0.0.jar.sha1 deleted file mode 100644 index ae5d443c7d5ad..0000000000000 --- a/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -50d81559e2604da31ca7961581fda41257ab0600 \ No newline at end of file diff --git a/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.1.0-snapshot-e460356abe.jar.sha1 b/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..c2468bbdd7cac --- /dev/null +++ b/plugins/analysis-stempel/licenses/lucene-analyzers-stempel-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +ba55aba7d278f6201b4ebd6dafbc7edb6fe94f8c \ No newline at end of file diff --git a/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.0.0.jar.sha1 b/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.0.0.jar.sha1 deleted file mode 100644 index af556321b7cf2..0000000000000 --- a/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -a0b165cb156178a0a91baa4b8d2f4c37278d92e0 \ No newline at end of file diff --git a/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.1.0-snapshot-e460356abe.jar.sha1 b/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..176e9533edde9 --- /dev/null +++ b/plugins/analysis-ukrainian/licenses/lucene-analyzers-morfologik-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +543d99fd2ba4302f3555792236350b201514d821 \ No newline at end of file diff --git a/server/licenses/lucene-analyzers-common-8.0.0.jar.sha1 b/server/licenses/lucene-analyzers-common-8.0.0.jar.sha1 deleted file mode 100644 index 3d51b62b1854d..0000000000000 --- a/server/licenses/lucene-analyzers-common-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -26fdada04adbb02164ef2d0f9abfa3b46ec30a0b \ No newline at end of file diff --git a/server/licenses/lucene-analyzers-common-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-analyzers-common-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..08507536ac134 --- /dev/null +++ b/server/licenses/lucene-analyzers-common-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +c20a8ae0c3bd769aa6c415ebea94ba466d9a631d \ No newline at end of file diff --git a/server/licenses/lucene-backward-codecs-8.0.0.jar.sha1 b/server/licenses/lucene-backward-codecs-8.0.0.jar.sha1 deleted file mode 100644 index e8ac2167ec45c..0000000000000 --- a/server/licenses/lucene-backward-codecs-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -90bda2357016dc0f4582938b01f5ae1142089d5f \ No newline at end of file diff --git a/server/licenses/lucene-backward-codecs-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-backward-codecs-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..6b0a3854c6f38 --- /dev/null +++ b/server/licenses/lucene-backward-codecs-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +6e8921ab37facdcc5c4b71f2612d72300d6de217 \ No newline at end of file diff --git a/server/licenses/lucene-core-8.0.0.jar.sha1 b/server/licenses/lucene-core-8.0.0.jar.sha1 deleted file mode 100644 index 2619abce7979a..0000000000000 --- a/server/licenses/lucene-core-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -407c555efb2d3253f51a676cc2089a5d29a3b7b7 \ No newline at end of file diff --git a/server/licenses/lucene-core-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-core-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..fea3658cf61bd --- /dev/null +++ b/server/licenses/lucene-core-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +3e85f77d8f8ed1db53dba387fbdec55a9f912639 \ No newline at end of file diff --git a/server/licenses/lucene-grouping-8.0.0.jar.sha1 b/server/licenses/lucene-grouping-8.0.0.jar.sha1 deleted file mode 100644 index 86294d2987fd7..0000000000000 --- a/server/licenses/lucene-grouping-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -a9004071d79e9f1eb5f2fe81c4b2b736d9d838bf \ No newline at end of file diff --git a/server/licenses/lucene-grouping-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-grouping-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..0bcc1ebab16de --- /dev/null +++ b/server/licenses/lucene-grouping-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +426a1822d888a6341f6bafccaad19e4a2ad88e25 \ No newline at end of file diff --git a/server/licenses/lucene-highlighter-8.0.0.jar.sha1 b/server/licenses/lucene-highlighter-8.0.0.jar.sha1 deleted file mode 100644 index ac8a49302cabd..0000000000000 --- a/server/licenses/lucene-highlighter-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -95c55c400dcfd5e08da1bab4f33eb3b6a65b1d16 \ No newline at end of file diff --git a/server/licenses/lucene-highlighter-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-highlighter-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..b2478a52c7a85 --- /dev/null +++ b/server/licenses/lucene-highlighter-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +f83fa4b264198dfb12436a803309a60f5588481d \ No newline at end of file diff --git a/server/licenses/lucene-join-8.0.0.jar.sha1 b/server/licenses/lucene-join-8.0.0.jar.sha1 deleted file mode 100644 index 88f0cdb3238c4..0000000000000 --- a/server/licenses/lucene-join-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -9364f8fd4fff476e619e84cb22f4cb0108039eda \ No newline at end of file diff --git a/server/licenses/lucene-join-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-join-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..ea3f6353ce09e --- /dev/null +++ b/server/licenses/lucene-join-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +f381131abef51f77d26bccbb213d1c8563c19ec4 \ No newline at end of file diff --git a/server/licenses/lucene-memory-8.0.0.jar.sha1 b/server/licenses/lucene-memory-8.0.0.jar.sha1 deleted file mode 100644 index 7dc4ebb2f5806..0000000000000 --- a/server/licenses/lucene-memory-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -9cce58e14792735cb7dc85fc84239193521d45eb \ No newline at end of file diff --git a/server/licenses/lucene-memory-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-memory-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..0bc96c932c18b --- /dev/null +++ b/server/licenses/lucene-memory-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +8d8733551b9eb71e1f59688b8e78e0b481974d7a \ No newline at end of file diff --git a/server/licenses/lucene-misc-8.0.0.jar.sha1 b/server/licenses/lucene-misc-8.0.0.jar.sha1 deleted file mode 100644 index 98c3fd2026362..0000000000000 --- a/server/licenses/lucene-misc-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -c444c2c41ab46744e2bbc61df5bdd2ac62ffe6a5 \ No newline at end of file diff --git a/server/licenses/lucene-misc-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-misc-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..fdde3da39a264 --- /dev/null +++ b/server/licenses/lucene-misc-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +13da0b22f01dff4a01c9907425464a440695104b \ No newline at end of file diff --git a/server/licenses/lucene-queries-8.0.0.jar.sha1 b/server/licenses/lucene-queries-8.0.0.jar.sha1 deleted file mode 100644 index 457b5fc9cba15..0000000000000 --- a/server/licenses/lucene-queries-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -197e4cf95fcbc787f128a33e4675528cfee65065 \ No newline at end of file diff --git a/server/licenses/lucene-queries-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-queries-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..c50232482b5c1 --- /dev/null +++ b/server/licenses/lucene-queries-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +6c3de4dbb98b5cc00875d76e817929374bb9e710 \ No newline at end of file diff --git a/server/licenses/lucene-queryparser-8.0.0.jar.sha1 b/server/licenses/lucene-queryparser-8.0.0.jar.sha1 deleted file mode 100644 index b1764ad6bc05f..0000000000000 --- a/server/licenses/lucene-queryparser-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -aa7d2e07736356405b4bece971d0a9ff1036dac3 \ No newline at end of file diff --git a/server/licenses/lucene-queryparser-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-queryparser-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..4a6c53845fc24 --- /dev/null +++ b/server/licenses/lucene-queryparser-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +539ef199c74ae6891ac93f55632fe140b9d4c291 \ No newline at end of file diff --git a/server/licenses/lucene-sandbox-8.0.0.jar.sha1 b/server/licenses/lucene-sandbox-8.0.0.jar.sha1 deleted file mode 100644 index 0cdbafa3e1ff3..0000000000000 --- a/server/licenses/lucene-sandbox-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -12f32d95596ff55c43c4c2378bf26e9fe3ea7dd9 \ No newline at end of file diff --git a/server/licenses/lucene-sandbox-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-sandbox-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..198b93230fb7c --- /dev/null +++ b/server/licenses/lucene-sandbox-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +0371141f658e2157babd490f0a8ddbcd5114b371 \ No newline at end of file diff --git a/server/licenses/lucene-spatial-8.0.0.jar.sha1 b/server/licenses/lucene-spatial-8.0.0.jar.sha1 deleted file mode 100644 index efa94df2e7319..0000000000000 --- a/server/licenses/lucene-spatial-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -5cd61c5c166a69571f39178b50d304d6e3914050 \ No newline at end of file diff --git a/server/licenses/lucene-spatial-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-spatial-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..ad6558f167d1c --- /dev/null +++ b/server/licenses/lucene-spatial-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +1bae56fbce29d6c597c00889dab1909f51f4aaac \ No newline at end of file diff --git a/server/licenses/lucene-spatial-extras-8.0.0.jar.sha1 b/server/licenses/lucene-spatial-extras-8.0.0.jar.sha1 deleted file mode 100644 index c3e6b2ac92cee..0000000000000 --- a/server/licenses/lucene-spatial-extras-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -72474064a247566c4c759eda1dfaac4d48778cd1 \ No newline at end of file diff --git a/server/licenses/lucene-spatial-extras-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-spatial-extras-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..66d5cc808a1ac --- /dev/null +++ b/server/licenses/lucene-spatial-extras-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +6eaed1dea9a18502ab9dffe55f081da6060373f7 \ No newline at end of file diff --git a/server/licenses/lucene-spatial3d-8.0.0.jar.sha1 b/server/licenses/lucene-spatial3d-8.0.0.jar.sha1 deleted file mode 100644 index f83e1d443a2a0..0000000000000 --- a/server/licenses/lucene-spatial3d-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -d40eb969881f58b47bace23865a1d5a9dd4ebf0a \ No newline at end of file diff --git a/server/licenses/lucene-spatial3d-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-spatial3d-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..0e1c69171e07e --- /dev/null +++ b/server/licenses/lucene-spatial3d-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +e54c6be78275637544a3080874dd04b0d92755e5 \ No newline at end of file diff --git a/server/licenses/lucene-suggest-8.0.0.jar.sha1 b/server/licenses/lucene-suggest-8.0.0.jar.sha1 deleted file mode 100644 index 6b60f4196d5f0..0000000000000 --- a/server/licenses/lucene-suggest-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -57ebd0c31e90f5f73aad7dbf7448cd59d8418f03 \ No newline at end of file diff --git a/server/licenses/lucene-suggest-8.1.0-snapshot-e460356abe.jar.sha1 b/server/licenses/lucene-suggest-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..2d1491c40dd0d --- /dev/null +++ b/server/licenses/lucene-suggest-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +e4c95d0bb740f18af520faebcebb968da3e0a687 \ No newline at end of file diff --git a/server/src/main/java/org/apache/lucene/search/uhighlight/CustomUnifiedHighlighter.java b/server/src/main/java/org/apache/lucene/search/uhighlight/CustomUnifiedHighlighter.java index d9bf9613cba07..bd5365131d52d 100644 --- a/server/src/main/java/org/apache/lucene/search/uhighlight/CustomUnifiedHighlighter.java +++ b/server/src/main/java/org/apache/lucene/search/uhighlight/CustomUnifiedHighlighter.java @@ -151,11 +151,6 @@ protected FieldHighlighter getFieldHighlighter(String field, Query query, Set 0 ? 1 : 0), getFormatter(field), noMatchSize, fieldValue); } - @Override - protected Collection preMultiTermQueryRewrite(Query query) { - return rewriteCustomQuery(query); - } - @Override protected Collection preSpanQueryRewrite(Query query) { return rewriteCustomQuery(query); diff --git a/server/src/main/java/org/elasticsearch/Version.java b/server/src/main/java/org/elasticsearch/Version.java index f6b5a47a46115..49b2f1caedd77 100644 --- a/server/src/main/java/org/elasticsearch/Version.java +++ b/server/src/main/java/org/elasticsearch/Version.java @@ -133,7 +133,7 @@ public class Version implements Comparable, ToXContentFragment { public static final int V_7_1_0_ID = 7010099; public static final Version V_7_1_0 = new Version(V_7_1_0_ID, org.apache.lucene.util.Version.LUCENE_8_0_0); public static final int V_8_0_0_ID = 8000099; - public static final Version V_8_0_0 = new Version(V_8_0_0_ID, org.apache.lucene.util.Version.LUCENE_8_0_0); + public static final Version V_8_0_0 = new Version(V_8_0_0_ID, org.apache.lucene.util.Version.LUCENE_8_1_0); public static final Version CURRENT = V_8_0_0; diff --git a/server/src/main/java/org/elasticsearch/index/codec/CodecService.java b/server/src/main/java/org/elasticsearch/index/codec/CodecService.java index efc19587658a2..6c3a2138e89bf 100644 --- a/server/src/main/java/org/elasticsearch/index/codec/CodecService.java +++ b/server/src/main/java/org/elasticsearch/index/codec/CodecService.java @@ -21,6 +21,7 @@ import org.apache.logging.log4j.Logger; import org.apache.lucene.codecs.Codec; +import org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.FSTLoadMode; import org.apache.lucene.codecs.lucene50.Lucene50StoredFieldsFormat.Mode; import org.apache.lucene.codecs.lucene80.Lucene80Codec; import org.elasticsearch.common.Nullable; @@ -48,7 +49,7 @@ public CodecService(@Nullable MapperService mapperService, Logger logger) { final MapBuilder codecs = MapBuilder.newMapBuilder(); if (mapperService == null) { codecs.put(DEFAULT_CODEC, new Lucene80Codec()); - codecs.put(BEST_COMPRESSION_CODEC, new Lucene80Codec(Mode.BEST_COMPRESSION)); + codecs.put(BEST_COMPRESSION_CODEC, new Lucene80Codec(Mode.BEST_COMPRESSION, FSTLoadMode.AUTO)); } else { codecs.put(DEFAULT_CODEC, new PerFieldMappingPostingFormatCodec(Mode.BEST_SPEED, mapperService, logger)); diff --git a/server/src/main/java/org/elasticsearch/index/codec/PerFieldMappingPostingFormatCodec.java b/server/src/main/java/org/elasticsearch/index/codec/PerFieldMappingPostingFormatCodec.java index 4a154abd8eadd..705141f1fb925 100644 --- a/server/src/main/java/org/elasticsearch/index/codec/PerFieldMappingPostingFormatCodec.java +++ b/server/src/main/java/org/elasticsearch/index/codec/PerFieldMappingPostingFormatCodec.java @@ -22,6 +22,7 @@ import org.apache.logging.log4j.Logger; import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.PostingsFormat; +import org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.FSTLoadMode; import org.apache.lucene.codecs.lucene50.Lucene50StoredFieldsFormat; import org.apache.lucene.codecs.lucene80.Lucene80Codec; import org.elasticsearch.common.lucene.Lucene; @@ -47,7 +48,7 @@ public class PerFieldMappingPostingFormatCodec extends Lucene80Codec { } public PerFieldMappingPostingFormatCodec(Lucene50StoredFieldsFormat.Mode compressionMode, MapperService mapperService, Logger logger) { - super(compressionMode); + super(compressionMode, FSTLoadMode.AUTO); this.mapperService = mapperService; this.logger = logger; } diff --git a/server/src/main/java/org/elasticsearch/index/query/IntervalBuilder.java b/server/src/main/java/org/elasticsearch/index/query/IntervalBuilder.java index e174b3fd49eee..92b4fa664193c 100644 --- a/server/src/main/java/org/elasticsearch/index/query/IntervalBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/IntervalBuilder.java @@ -26,9 +26,9 @@ import org.apache.lucene.analysis.tokenattributes.PositionLengthAttribute; import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute; import org.apache.lucene.index.LeafReaderContext; -import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.MatchesIterator; +import org.apache.lucene.search.QueryVisitor; import org.apache.lucene.search.intervals.IntervalIterator; import org.apache.lucene.search.intervals.Intervals; import org.apache.lucene.search.intervals.IntervalsSource; @@ -37,9 +37,10 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.List; -import java.util.Set; /** * Constructs an IntervalsSource based on analyzed text @@ -287,14 +288,17 @@ public MatchesIterator matches(String field, LeafReaderContext ctx, int doc) { return null; } + @Override + public void visit(String field, QueryVisitor visitor) {} + @Override public int minExtent() { return 0; } @Override - public void extractTerms(String field, Set terms) { - + public Collection pullUpDisjunctions() { + return Collections.emptyList(); } @Override diff --git a/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.0.0.jar.sha1 b/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.0.0.jar.sha1 deleted file mode 100644 index 2619abce7979a..0000000000000 --- a/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.0.0.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -407c555efb2d3253f51a676cc2089a5d29a3b7b7 \ No newline at end of file diff --git a/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.1.0-snapshot-e460356abe.jar.sha1 b/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.1.0-snapshot-e460356abe.jar.sha1 new file mode 100644 index 0000000000000..fea3658cf61bd --- /dev/null +++ b/x-pack/plugin/sql/sql-action/licenses/lucene-core-8.1.0-snapshot-e460356abe.jar.sha1 @@ -0,0 +1 @@ +3e85f77d8f8ed1db53dba387fbdec55a9f912639 \ No newline at end of file From fc991b815acea891809095c272a87f747b3a805f Mon Sep 17 00:00:00 2001 From: jimczi Date: Mon, 8 Apr 2019 14:53:52 +0200 Subject: [PATCH 2/5] fix failing tests after upgrade --- .../elasticsearch/common/lucene/uid/VersionsTests.java | 2 +- .../elasticsearch/index/engine/InternalEngineTests.java | 9 ++++++++- .../search/profile/query/QueryProfilerTests.java | 8 +++++--- .../org/elasticsearch/search/query/QueryPhaseTests.java | 1 - 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/server/src/test/java/org/elasticsearch/common/lucene/uid/VersionsTests.java b/server/src/test/java/org/elasticsearch/common/lucene/uid/VersionsTests.java index b108020c026f8..b18daf07bf361 100644 --- a/server/src/test/java/org/elasticsearch/common/lucene/uid/VersionsTests.java +++ b/server/src/test/java/org/elasticsearch/common/lucene/uid/VersionsTests.java @@ -205,7 +205,7 @@ public void testLuceneVersionOnUnknownVersions() { assertEquals(Version.V_6_0_0.luceneVersion.major - 1, version.luceneVersion.major); // future version, should be the same version as today - version = Version.fromString("7.77.1"); + version = Version.fromString("8.77.1"); assertEquals(Version.CURRENT.luceneVersion, version.luceneVersion); } } diff --git a/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java b/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java index 3636967e66104..aa7e26b1374ce 100644 --- a/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java +++ b/server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java @@ -27,6 +27,7 @@ import org.apache.logging.log4j.core.LogEvent; import org.apache.logging.log4j.core.appender.AbstractAppender; import org.apache.logging.log4j.core.filter.RegexFilter; +import org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat; import org.apache.lucene.codecs.lucene50.Lucene50StoredFieldsFormat; import org.apache.lucene.document.Field; import org.apache.lucene.document.LongPoint; @@ -300,7 +301,13 @@ public void testSegments() throws Exception { assertThat(segments.get(0).getDeletedDocs(), equalTo(0)); assertThat(segments.get(0).isCompound(), equalTo(true)); assertThat(segments.get(0).ramTree, nullValue()); - assertThat(segments.get(0).getAttributes().keySet(), Matchers.contains(Lucene50StoredFieldsFormat.MODE_KEY)); + assertThat(segments.get(0).getAttributes().keySet(), + Matchers.contains( + // TODO: Lucene50PostingsFormat#MODE_KEY should be public ? + Lucene50PostingsFormat.class.getSimpleName() + ".fstMode", + Lucene50StoredFieldsFormat.MODE_KEY + ) + ); engine.flush(); diff --git a/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerTests.java b/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerTests.java index 78a8049d741bd..85a95815600d6 100644 --- a/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerTests.java +++ b/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerTests.java @@ -124,7 +124,7 @@ public void testConstantScoreQuery() throws IOException { QueryProfiler profiler = new QueryProfiler(); searcher.setProfiler(profiler); Query query = new ConstantScoreQuery(new TermQuery(new Term("foo", "bar"))); - searcher.search(query, 1); + searcher.search(query, Integer.MAX_VALUE); List results = profiler.getTree(); assertEquals(1, results.size()); Map breakdownConstantScoreQuery = results.get(0).getTimeBreakdown(); @@ -159,8 +159,10 @@ public void testConstantScoreQuery() throws IOException { assertThat(breakdownTermQuery.get(QueryTimingType.SCORE.toString() + "_count").longValue(), equalTo(0L)); assertThat(breakdownTermQuery.get(QueryTimingType.MATCH.toString() + "_count").longValue(), equalTo(0L)); - assertEquals(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), - breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue()); + // TODO: ConstantScoreScorer does not implement Scorer#getChildren since Lucene 8.1.0, + // we should change this test or rethink how we extract inner scorers in profiling. + // assertEquals(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), + // breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue()); long rewriteTime = profiler.getRewriteTime(); assertThat(rewriteTime, greaterThan(0L)); diff --git a/server/src/test/java/org/elasticsearch/search/query/QueryPhaseTests.java b/server/src/test/java/org/elasticsearch/search/query/QueryPhaseTests.java index 16b18efe62322..e65b4aa377a40 100644 --- a/server/src/test/java/org/elasticsearch/search/query/QueryPhaseTests.java +++ b/server/src/test/java/org/elasticsearch/search/query/QueryPhaseTests.java @@ -317,7 +317,6 @@ public void testInOrderScrollOptimization() throws Exception { contextSearcher = getAssertingEarlyTerminationSearcher(reader, size); QueryPhase.execute(context, contextSearcher, checkCancelled -> {}); assertThat(context.queryResult().topDocs().topDocs.totalHits.value, equalTo((long) numDocs)); - assertTrue(context.queryResult().terminatedEarly()); assertThat(context.terminateAfter(), equalTo(size)); assertThat(context.queryResult().getTotalHits().value, equalTo((long) numDocs)); assertThat(context.queryResult().topDocs().topDocs.scoreDocs[0].doc, greaterThanOrEqualTo(size)); From 7247958be9f9484f003cc66ee693a5fbdcaf4424 Mon Sep 17 00:00:00 2001 From: jimczi Date: Mon, 8 Apr 2019 16:56:49 +0200 Subject: [PATCH 3/5] adapt highlighter code to the new query visitor --- .../uhighlight/CustomUnifiedHighlighter.java | 18 +----------------- .../search/function/FunctionScoreQuery.java | 8 ++++++++ .../index/search/ESToParentBlockJoinQuery.java | 8 ++++++++ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/server/src/main/java/org/apache/lucene/search/uhighlight/CustomUnifiedHighlighter.java b/server/src/main/java/org/apache/lucene/search/uhighlight/CustomUnifiedHighlighter.java index bd5365131d52d..4dd36896bf346 100644 --- a/server/src/main/java/org/apache/lucene/search/uhighlight/CustomUnifiedHighlighter.java +++ b/server/src/main/java/org/apache/lucene/search/uhighlight/CustomUnifiedHighlighter.java @@ -21,12 +21,10 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.index.Term; -import org.apache.lucene.queries.CommonTermsQuery; import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.PrefixQuery; import org.apache.lucene.search.Query; -import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.spans.SpanMultiTermQueryWrapper; import org.apache.lucene.search.spans.SpanNearQuery; import org.apache.lucene.search.spans.SpanOrQuery; @@ -36,12 +34,9 @@ import org.apache.lucene.util.automaton.CharacterRunAutomaton; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.lucene.search.MultiPhrasePrefixQuery; -import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery; -import org.elasticsearch.index.search.ESToParentBlockJoinQuery; import java.io.IOException; import java.text.BreakIterator; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; @@ -170,7 +165,7 @@ private Collection rewriteCustomQuery(Query query) { SpanQuery[] innerQueries = new SpanQuery[terms[i].length]; for (int j = 0; j < terms[i].length; j++) { if (i == sizeMinus1) { - innerQueries[j] = new SpanMultiTermQueryWrapper(new PrefixQuery(terms[i][j])); + innerQueries[j] = new SpanMultiTermQueryWrapper<>(new PrefixQuery(terms[i][j])); } else { innerQueries[j] = new SpanTermQuery(terms[i][j]); } @@ -195,17 +190,6 @@ private Collection rewriteCustomQuery(Query query) { boolean inorder = (mpq.getSlop() == 0); return Collections.singletonList(new SpanNearQuery(positionSpanQueries, mpq.getSlop() + positionGaps, inorder)); - } else if (query instanceof CommonTermsQuery) { - CommonTermsQuery ctq = (CommonTermsQuery) query; - List tqs = new ArrayList<> (); - for (Term term : ctq.getTerms()) { - tqs.add(new TermQuery(term)); - } - return tqs; - } else if (query instanceof FunctionScoreQuery) { - return Collections.singletonList(((FunctionScoreQuery) query).getSubQuery()); - } else if (query instanceof ESToParentBlockJoinQuery) { - return Collections.singletonList(((ESToParentBlockJoinQuery) query).getChildQuery()); } else { return null; } diff --git a/server/src/main/java/org/elasticsearch/common/lucene/search/function/FunctionScoreQuery.java b/server/src/main/java/org/elasticsearch/common/lucene/search/function/FunctionScoreQuery.java index 95fbed64a25f5..2592c645111d2 100644 --- a/server/src/main/java/org/elasticsearch/common/lucene/search/function/FunctionScoreQuery.java +++ b/server/src/main/java/org/elasticsearch/common/lucene/search/function/FunctionScoreQuery.java @@ -22,10 +22,12 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.Term; +import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.Explanation; import org.apache.lucene.search.FilterScorer; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; +import org.apache.lucene.search.QueryVisitor; import org.apache.lucene.search.Scorer; import org.apache.lucene.search.ScorerSupplier; import org.apache.lucene.search.Weight; @@ -195,6 +197,12 @@ public CombineFunction getCombineFunction() { return combineFunction; } + @Override + public void visit(QueryVisitor visitor) { + // Highlighters must visit the child query to extract terms + subQuery.visit(visitor.getSubVisitor(BooleanClause.Occur.MUST, this)); + } + @Override public Query rewrite(IndexReader reader) throws IOException { Query rewritten = super.rewrite(reader); diff --git a/server/src/main/java/org/elasticsearch/index/search/ESToParentBlockJoinQuery.java b/server/src/main/java/org/elasticsearch/index/search/ESToParentBlockJoinQuery.java index 5e6aa3bb7c456..30cd6e52f0dbd 100644 --- a/server/src/main/java/org/elasticsearch/index/search/ESToParentBlockJoinQuery.java +++ b/server/src/main/java/org/elasticsearch/index/search/ESToParentBlockJoinQuery.java @@ -20,8 +20,10 @@ package org.elasticsearch.index.search; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; +import org.apache.lucene.search.QueryVisitor; import org.apache.lucene.search.Weight; import org.apache.lucene.search.join.BitSetProducer; import org.apache.lucene.search.join.ScoreMode; @@ -74,6 +76,12 @@ public Query rewrite(IndexReader reader) throws IOException { return super.rewrite(reader); } + @Override + public void visit(QueryVisitor visitor) { + // Highlighters must visit the child query to extract terms + query.getChildQuery().visit(visitor.getSubVisitor(BooleanClause.Occur.MUST, this)); + } + @Override public Weight createWeight(IndexSearcher searcher, org.apache.lucene.search.ScoreMode scoreMode, float boost) throws IOException { return query.createWeight(searcher, scoreMode, boost); From 1ae853785d907d6eb44d45563aa43d0a3c222ad4 Mon Sep 17 00:00:00 2001 From: jimczi Date: Wed, 10 Apr 2019 11:42:34 +0200 Subject: [PATCH 4/5] iter --- docs/Versions.asciidoc | 4 ++-- .../common/WordDelimiterGraphTokenFilterFactoryTests.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/Versions.asciidoc b/docs/Versions.asciidoc index bbd001b252e0d..a1391fca05a6d 100644 --- a/docs/Versions.asciidoc +++ b/docs/Versions.asciidoc @@ -1,8 +1,8 @@ :version: 8.0.0-alpha1 :major-version: 8.x :prev-major-version: 7.x -:lucene_version: 8.0.0 -:lucene_version_path: 8_0_0 +:lucene_version: 8.1.0 +:lucene_version_path: 8_1_0 :branch: master :jdk: 11.0.2 :jdk_major: 11 diff --git a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WordDelimiterGraphTokenFilterFactoryTests.java b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WordDelimiterGraphTokenFilterFactoryTests.java index 0a77c0c42d0a0..d799674f231a1 100644 --- a/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WordDelimiterGraphTokenFilterFactoryTests.java +++ b/modules/analysis-common/src/test/java/org/elasticsearch/analysis/common/WordDelimiterGraphTokenFilterFactoryTests.java @@ -47,9 +47,9 @@ public void testMultiTerms() throws IOException { TokenFilterFactory tokenFilter = analysis.tokenFilter.get("my_word_delimiter"); String source = "PowerShot 500-42 wi-fi wi-fi-4000 j2se O'Neil's"; - String[] expected = new String[] { "PowerShot", "PowerShot", "Power", "Shot", "50042", - "500-42", "500", "42", "wifi", "wi-fi", "wi", "fi", "wifi4000", "wi-fi-4000", "wi", - "fi", "4000", "j2se", "j2se", "j", "2", "se", "ONeil", "O'Neil's", "O", "Neil" }; + String[] expected = new String[] { "PowerShot", "PowerShot", "Power", "Shot", "500-42", + "50042", "500", "42", "wi-fi", "wifi", "wi", "fi", "wi-fi-4000", "wifi4000", "wi", + "fi", "4000", "j2se", "j2se", "j", "2", "se", "O'Neil's", "ONeil", "O", "Neil" }; Tokenizer tokenizer = new WhitespaceTokenizer(); tokenizer.setReader(new StringReader(source)); int[] expectedIncr = new int[] { 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, From c03920875520a8d05cc440773cfdae42225704a2 Mon Sep 17 00:00:00 2001 From: jimczi Date: Thu, 11 Apr 2019 19:19:23 +0200 Subject: [PATCH 5/5] Revert #33196: the constantscore scorer does not expose the inner scorer anymore --- .../search/profile/query/ProfileScorer.java | 30 --- .../profile/query/QueryProfilerTests.java | 206 ------------------ 2 files changed, 236 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/search/profile/query/ProfileScorer.java b/server/src/main/java/org/elasticsearch/search/profile/query/ProfileScorer.java index ab8fb5dbcae02..b2354667889b6 100644 --- a/server/src/main/java/org/elasticsearch/search/profile/query/ProfileScorer.java +++ b/server/src/main/java/org/elasticsearch/search/profile/query/ProfileScorer.java @@ -19,9 +19,7 @@ package org.elasticsearch.search.profile.query; -import org.apache.lucene.search.ConstantScoreQuery; import org.apache.lucene.search.DocIdSetIterator; -import org.apache.lucene.search.Scorable; import org.apache.lucene.search.Scorer; import org.apache.lucene.search.TwoPhaseIterator; import org.apache.lucene.search.Weight; @@ -40,8 +38,6 @@ final class ProfileScorer extends Scorer { private ProfileWeight profileWeight; private final Timer scoreTimer, nextDocTimer, advanceTimer, matchTimer, shallowAdvanceTimer, computeMaxScoreTimer; - private final boolean isConstantScoreQuery; - ProfileScorer(ProfileWeight w, Scorer scorer, QueryProfileBreakdown profile) throws IOException { super(w); @@ -53,26 +49,6 @@ final class ProfileScorer extends Scorer { matchTimer = profile.getTimer(QueryTimingType.MATCH); shallowAdvanceTimer = profile.getTimer(QueryTimingType.SHALLOW_ADVANCE); computeMaxScoreTimer = profile.getTimer(QueryTimingType.COMPUTE_MAX_SCORE); - ProfileScorer profileScorer = null; - if (w.getQuery() instanceof ConstantScoreQuery && scorer instanceof ProfileScorer) { - //Case when we have a totalHits query and it is not cached - profileScorer = (ProfileScorer) scorer; - } else if (w.getQuery() instanceof ConstantScoreQuery && scorer.getChildren().size() == 1) { - //Case when we have a top N query. If the scorer has no children, it is because it is cached - //and in that case we do not do any special treatment - Scorable childScorer = scorer.getChildren().iterator().next().child; - if (childScorer instanceof ProfileScorer) { - profileScorer = (ProfileScorer) childScorer; - } - } - if (profileScorer != null) { - isConstantScoreQuery = true; - profile.setTimer(QueryTimingType.NEXT_DOC, profileScorer.nextDocTimer); - profile.setTimer(QueryTimingType.ADVANCE, profileScorer.advanceTimer); - profile.setTimer(QueryTimingType.MATCH, profileScorer.matchTimer); - } else { - isConstantScoreQuery = false; - } } @Override @@ -102,9 +78,6 @@ public Collection getChildren() throws IOException { @Override public DocIdSetIterator iterator() { - if (isConstantScoreQuery) { - return scorer.iterator(); - } final DocIdSetIterator in = scorer.iterator(); return new DocIdSetIterator() { @@ -142,9 +115,6 @@ public long cost() { @Override public TwoPhaseIterator twoPhaseIterator() { - if (isConstantScoreQuery) { - return scorer.twoPhaseIterator(); - } final TwoPhaseIterator in = scorer.twoPhaseIterator(); if (in == null) { return null; diff --git a/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerTests.java b/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerTests.java index 85a95815600d6..275349e15cdf1 100644 --- a/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerTests.java +++ b/server/src/test/java/org/elasticsearch/search/profile/query/QueryProfilerTests.java @@ -28,7 +28,6 @@ import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.Term; -import org.apache.lucene.search.ConstantScoreQuery; import org.apache.lucene.search.Explanation; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.LeafCollector; @@ -120,211 +119,6 @@ public void testBasic() throws IOException { assertThat(rewriteTime, greaterThan(0L)); } - public void testConstantScoreQuery() throws IOException { - QueryProfiler profiler = new QueryProfiler(); - searcher.setProfiler(profiler); - Query query = new ConstantScoreQuery(new TermQuery(new Term("foo", "bar"))); - searcher.search(query, Integer.MAX_VALUE); - List results = profiler.getTree(); - assertEquals(1, results.size()); - Map breakdownConstantScoreQuery = results.get(0).getTimeBreakdown(); - assertEquals(1, results.get(0).getProfiledChildren().size()); - Map breakdownTermQuery = results.get(0).getProfiledChildren().get(0).getTimeBreakdown(); - - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.CREATE_WEIGHT.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.BUILD_SCORER.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.ADVANCE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.SCORE.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.MATCH.toString()).longValue(), equalTo(0L)); - - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.CREATE_WEIGHT.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.BUILD_SCORER.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.ADVANCE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.SCORE.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.MATCH.toString() + "_count").longValue(), equalTo(0L)); - - assertThat(breakdownTermQuery.get(QueryTimingType.CREATE_WEIGHT.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.BUILD_SCORER.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.ADVANCE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.SCORE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.MATCH.toString()).longValue(), equalTo(0L)); - - assertThat(breakdownTermQuery.get(QueryTimingType.CREATE_WEIGHT.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.BUILD_SCORER.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.ADVANCE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.SCORE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.MATCH.toString() + "_count").longValue(), equalTo(0L)); - - // TODO: ConstantScoreScorer does not implement Scorer#getChildren since Lucene 8.1.0, - // we should change this test or rethink how we extract inner scorers in profiling. - // assertEquals(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), - // breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue()); - - long rewriteTime = profiler.getRewriteTime(); - assertThat(rewriteTime, greaterThan(0L)); - } - - public void testConstantScoreTotalHitsBeingCachedQuery() throws IOException { - Query query = new ConstantScoreQuery(new TermQuery(new Term("foo", "bar"))); - //clean cache and make sure queries will be cached - searcher.setQueryCache(IndexSearcher.getDefaultQueryCache()); - searcher.setQueryCachingPolicy(ALWAYS_CACHE_POLICY); - - QueryProfiler profiler = new QueryProfiler(); - searcher.setProfiler(profiler); - TotalHitCountCollector collector = new TotalHitCountCollector(); - searcher.search(query, collector); - - List results = profiler.getTree(); - assertEquals(1, results.size()); - Map breakdownConstantScoreQuery = results.get(0).getTimeBreakdown(); - assertEquals(1, results.get(0).getProfiledChildren().size()); - Map breakdownTermQuery = results.get(0).getProfiledChildren().get(0).getTimeBreakdown(); - //In this case scorers for constant score query and term query are disconnected. - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.CREATE_WEIGHT.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.BUILD_SCORER.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.ADVANCE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.SCORE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.MATCH.toString()).longValue(), equalTo(0L)); - - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.CREATE_WEIGHT.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.BUILD_SCORER.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.ADVANCE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.SCORE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.MATCH.toString() + "_count").longValue(), equalTo(0L)); - - assertThat(breakdownTermQuery.get(QueryTimingType.CREATE_WEIGHT.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.BUILD_SCORER.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.ADVANCE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.SCORE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.MATCH.toString()).longValue(), equalTo(0L)); - - assertThat(breakdownTermQuery.get(QueryTimingType.CREATE_WEIGHT.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.BUILD_SCORER.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.ADVANCE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.SCORE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.MATCH.toString() + "_count").longValue(), equalTo(0L)); - - long rewriteTime = profiler.getRewriteTime(); - assertThat(rewriteTime, greaterThan(0L)); - } - - public void testConstantScoreTotalHitsNotCachedQuery() throws IOException { - Query query = new ConstantScoreQuery(new TermQuery(new Term("foo", "bar"))); - - //clean cache and make sure queries will not be cached - searcher.setQueryCache(IndexSearcher.getDefaultQueryCache()); - searcher.setQueryCachingPolicy(NEVER_CACHE_POLICY); - - QueryProfiler profiler = new QueryProfiler(); - searcher.setProfiler(profiler); - TotalHitCountCollector collector = new TotalHitCountCollector(); - searcher.search(query, collector); - - List results = profiler.getTree(); - assertEquals(1, results.size()); - Map breakdownConstantScoreQuery = results.get(0).getTimeBreakdown(); - assertEquals(1, results.get(0).getProfiledChildren().size()); - Map breakdownTermQuery = results.get(0).getProfiledChildren().get(0).getTimeBreakdown(); - //Timing from the scorer of term query are inherited by constant score query scorer. - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.CREATE_WEIGHT.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.BUILD_SCORER.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.ADVANCE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.SCORE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.MATCH.toString()).longValue(), equalTo(0L)); - - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.CREATE_WEIGHT.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.BUILD_SCORER.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.ADVANCE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.SCORE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.MATCH.toString() + "_count").longValue(), equalTo(0L)); - - assertThat(breakdownTermQuery.get(QueryTimingType.BUILD_SCORER.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.ADVANCE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.SCORE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.MATCH.toString()).longValue(), equalTo(0L)); - - assertThat(breakdownTermQuery.get(QueryTimingType.CREATE_WEIGHT.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.BUILD_SCORER.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.ADVANCE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.SCORE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.MATCH.toString() + "_count").longValue(), equalTo(0L)); - - - assertEquals(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), - breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue()); - - - long rewriteTime = profiler.getRewriteTime(); - assertThat(rewriteTime, greaterThan(0L)); - } - - public void testConstantScoreTotalHitsCachedQuery() throws IOException { - Query query = new ConstantScoreQuery(new TermQuery(new Term("foo", "bar"))); - - //clean cache and make sure queries will be cached - searcher.setQueryCache(IndexSearcher.getDefaultQueryCache()); - searcher.setQueryCachingPolicy(ALWAYS_CACHE_POLICY); - //Put query on cache - TotalHitCountCollector collector = new TotalHitCountCollector(); - searcher.search(query, collector); - - QueryProfiler profiler = new QueryProfiler(); - searcher.setProfiler(profiler); - collector = new TotalHitCountCollector(); - searcher.search(query, collector); - - List results = profiler.getTree(); - assertEquals(1, results.size()); - Map breakdownConstantScoreQuery = results.get(0).getTimeBreakdown(); - assertEquals(1, results.get(0).getProfiledChildren().size()); - Map breakdownTermQuery = results.get(0).getProfiledChildren().get(0).getTimeBreakdown(); - - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.CREATE_WEIGHT.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.BUILD_SCORER.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.ADVANCE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.SCORE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.MATCH.toString()).longValue(), equalTo(0L)); - - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.CREATE_WEIGHT.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.BUILD_SCORER.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.NEXT_DOC.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.ADVANCE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.SCORE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownConstantScoreQuery.get(QueryTimingType.MATCH.toString() + "_count").longValue(), equalTo(0L)); - - assertThat(breakdownTermQuery.get(QueryTimingType.CREATE_WEIGHT.toString()).longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.BUILD_SCORER.toString()).longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString()).longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.ADVANCE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.SCORE.toString()).longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.MATCH.toString()).longValue(), equalTo(0L)); - - assertThat(breakdownTermQuery.get(QueryTimingType.CREATE_WEIGHT.toString() + "_count").longValue(), greaterThan(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.BUILD_SCORER.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.NEXT_DOC.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.ADVANCE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.SCORE.toString() + "_count").longValue(), equalTo(0L)); - assertThat(breakdownTermQuery.get(QueryTimingType.MATCH.toString() + "_count").longValue(), equalTo(0L)); - - long rewriteTime = profiler.getRewriteTime(); - assertThat(rewriteTime, greaterThan(0L)); - } - - public void testNoScoring() throws IOException { QueryProfiler profiler = new QueryProfiler(); searcher.setProfiler(profiler);