Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to lucene-9.0.0-snapshot-32a0a16aff0 #73324

Merged
merged 93 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
5d57ce4
Upgrade to lucene-9.0.0-snapshot-a12260eb950
romseygeek May 24, 2021
2b3cc5b
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Jun 10, 2021
a83cff2
upgrade to new snapshot; precommit happy
romseygeek Jun 10, 2021
3af9f65
Merge branch 'master' into lucene-9-upgrade
jpountz Jul 13, 2021
eef74fc
More compile fixes.
jpountz Jul 13, 2021
3e8ab5c
Undo unnecessary change.
jpountz Jul 13, 2021
449050b
Merge remote-tracking branch 'elastic/master' into lucene-9-upgrade
dnhatn Jul 16, 2021
44c6f49
fix compile
dnhatn Jul 16, 2021
6e7b433
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Jul 30, 2021
3e8da46
compilation + precommit
romseygeek Jul 30, 2021
2dc6a3d
small updates
romseygeek Jul 30, 2021
e13aeb2
Merge remote-tracking branch 'romseygeek/lucene-9-upgrade' into lucen…
romseygeek Jul 30, 2021
a4e9359
iter
romseygeek Aug 2, 2021
d9fe30e
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Aug 2, 2021
896b1e0
another upgrade...
romseygeek Aug 2, 2021
104787f
Lucene test naming conventions
romseygeek Aug 2, 2021
019482f
schema consistency
romseygeek Aug 2, 2021
4731b14
Translog + a few other places need to use CodecUtil.read/writeBEInt f…
romseygeek Aug 2, 2021
d139867
TopDocs.merge doesn't set shardIndex; new filters; codecs; math is ha…
romseygeek Aug 2, 2021
873f02d
iter
romseygeek Aug 2, 2021
fd3f4a9
more precommit
romseygeek Aug 3, 2021
aa6e6b2
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Aug 4, 2021
34ba409
move and rename org.apache.lucene tests
romseygeek Aug 4, 2021
4d4d57a
precommit
romseygeek Aug 4, 2021
286f2d4
security permission for SPIClassIterator
romseygeek Aug 4, 2021
3a7ebd5
analysis fixes
romseygeek Aug 4, 2021
2d637ab
some more BEInt/Long changes
romseygeek Aug 4, 2021
2f04a83
don't need to set shard index in merge
romseygeek Aug 4, 2021
267330d
iter
romseygeek Aug 4, 2021
c600e0e
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Aug 9, 2021
78b7937
Use EndiannessReverserUtil where necessary
romseygeek Aug 10, 2021
3323d84
Don't run field usage API tests on pre-8 versions due to changes in p…
romseygeek Aug 10, 2021
1f53a85
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Aug 10, 2021
cd6f051
precommit
romseygeek Aug 10, 2021
5c253af
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Aug 12, 2021
1ba5d0a
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 1, 2021
f32bbb4
correct version; collapse tests to use STRING rather than STRING_VAL
romseygeek Sep 2, 2021
3d88695
comment out check for points usage
romseygeek Sep 2, 2021
deab9fc
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 2, 2021
7be175d
rest compat for field usage stats
romseygeek Sep 2, 2021
4cb1219
access control on analysis plugin reloading
romseygeek Sep 3, 2021
38e830d
Merge remote-tracking branch 'romseygeek/lucene-9-upgrade' into lucen…
romseygeek Sep 3, 2021
7981dd5
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 3, 2021
d11ce1a
upgrade ICU from 62.1 to 68.2
romseygeek Sep 6, 2021
e66ec36
increment version on checkpoint and use endiannessreverserutil on old…
romseygeek Sep 6, 2021
01b3050
Remove FieldReader breaker optimization that only works for lucene 9 …
romseygeek Sep 6, 2021
126f0c0
better verifying checksum impl
romseygeek Sep 6, 2021
9de190e
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 6, 2021
4c56125
update completion postings format to 90
romseygeek Sep 6, 2021
77fc68e
Bump metadata versions where possible to avoid EndiannessReverserUtil
romseygeek Sep 6, 2021
9b2ef3f
Revert "Bump metadata versions where possible to avoid EndiannessReve…
romseygeek Sep 6, 2021
f34559d
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 9, 2021
cca2527
Further upgrades
romseygeek Sep 10, 2021
b1c7ed3
new version
romseygeek Sep 13, 2021
f14f58a
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 13, 2021
78d0fd8
don't run field usage API in bwc mode, output values are different be…
romseygeek Sep 13, 2021
f2fef47
haversin in meters, not kilometers
romseygeek Sep 13, 2021
5dc4147
change in max clause count behaviour
romseygeek Sep 13, 2021
93cef82
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 13, 2021
872befb
composite agg tests
romseygeek Sep 13, 2021
f5e957d
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 13, 2021
0ac7c65
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 15, 2021
1a34d10
Revert "haversin in meters, not kilometers"
romseygeek Sep 15, 2021
d988372
pickup sort opto fix
romseygeek Sep 15, 2021
b7cca7d
Allow async check index in searchable snapshot tests
romseygeek Sep 15, 2021
c53b63b
Merge branch 'master' into lucene-9-upgrade
dnhatn Sep 17, 2021
a6aee03
Disable sort optimization while query Lucene changes
dnhatn Sep 17, 2021
c7030b7
update shas
dnhatn Sep 17, 2021
6727003
fix tests
dnhatn Sep 17, 2021
af0ee84
fix javadocs
dnhatn Sep 17, 2021
ba960a4
awaitfix testRecovery
dnhatn Sep 17, 2021
7ce3385
Merge branch 'master' into lucene-9-upgrade
dnhatn Sep 20, 2021
db2be34
fix compile
dnhatn Sep 20, 2021
3eedcef
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 20, 2021
af151d3
New snapshot, including lucene 8.10 version constant
romseygeek Sep 20, 2021
7eb7921
precommit
romseygeek Sep 20, 2021
7fb0900
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 20, 2021
a4c878a
japanese completion filter
romseygeek Sep 20, 2021
46fc8c1
No need for endianness shenanigans in TransportSearchHelper
romseygeek Sep 20, 2021
f79933e
Merge branch 'master' into lucene-9-upgrade
dnhatn Sep 20, 2021
cd50069
Remove NORELEASE
dnhatn Sep 20, 2021
a4e6b32
Do not remove max_merge_at_once_explicit
dnhatn Sep 20, 2021
e53d3be
use existing filtered store fields visitor
dnhatn Sep 20, 2021
7790565
minimize changes
dnhatn Sep 20, 2021
1cbf2cd
Remove ram tree
dnhatn Sep 20, 2021
251cb8b
delay expose analyzers
dnhatn Sep 20, 2021
e5609d0
stylecheck
dnhatn Sep 20, 2021
4fcb718
remove japanese_completion
dnhatn Sep 20, 2021
9d7e27f
sort optimization
dnhatn Sep 20, 2021
b3b57de
precommit
dnhatn Sep 20, 2021
16b26da
fix unknown analyzer
dnhatn Sep 20, 2021
fcbf2b4
Merge remote-tracking branch 'origin/master' into lucene-9-upgrade
romseygeek Sep 21, 2021
b9d9c26
deef
romseygeek Sep 21, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-tools-internal/version.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
elasticsearch = 8.0.0
lucene = 8.9.0
lucene = 9.0.0-snapshot-7450a7e64be

bundled_jdk_vendor = adoptium
bundled_jdk = 16.0.2+7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

package org.elasticsearch.common.settings;

import org.apache.lucene.backward_codecs.store.EndiannessReverserUtil;
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.store.DataOutput;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexOutput;
Expand Down Expand Up @@ -345,13 +347,14 @@ private void possiblyAlterEncryptedBytes(
byte[] encryptedBytes,
int truncEncryptedDataLength
) throws Exception {
indexOutput.writeInt(4 + salt.length + 4 + iv.length + 4 + encryptedBytes.length);
indexOutput.writeInt(salt.length);
indexOutput.writeBytes(salt, salt.length);
indexOutput.writeInt(iv.length);
indexOutput.writeBytes(iv, iv.length);
indexOutput.writeInt(encryptedBytes.length - truncEncryptedDataLength);
indexOutput.writeBytes(encryptedBytes, encryptedBytes.length);
DataOutput out = EndiannessReverserUtil.wrapDataOutput(indexOutput);
out.writeInt(4 + salt.length + 4 + iv.length + 4 + encryptedBytes.length);
out.writeInt(salt.length);
out.writeBytes(salt, salt.length);
out.writeInt(iv.length);
out.writeBytes(iv, iv.length);
out.writeInt(encryptedBytes.length - truncEncryptedDataLength);
out.writeBytes(encryptedBytes, encryptedBytes.length);
}

public void testUpgradeAddsSeed() throws Exception {
Expand Down Expand Up @@ -382,7 +385,7 @@ public void testBackcompatV1() throws Exception {
Path configDir = env.configFile();
try (
Directory directory = newFSDirectory(configDir);
IndexOutput output = directory.createOutput("elasticsearch.keystore", IOContext.DEFAULT)
IndexOutput output = EndiannessReverserUtil.createOutput(directory, "elasticsearch.keystore", IOContext.DEFAULT);
) {
CodecUtil.writeHeader(output, "elasticsearch.keystore", 1);
output.writeByte((byte) 0); // hasPassword = false
Expand Down Expand Up @@ -417,9 +420,8 @@ public void testBackcompatV2() throws Exception {
random().nextBytes(fileBytes);
try (
Directory directory = newFSDirectory(configDir);
IndexOutput output = directory.createOutput("elasticsearch.keystore", IOContext.DEFAULT)
IndexOutput output = EndiannessReverserUtil.createOutput(directory, "elasticsearch.keystore", IOContext.DEFAULT);
) {

CodecUtil.writeHeader(output, "elasticsearch.keystore", 2);
output.writeByte((byte) 0); // hasPassword = false
output.writeString("PKCS12");
Expand Down
4 changes: 2 additions & 2 deletions docs/Versions.asciidoc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

include::{docs-root}/shared/versions/stack/{source_branch}.asciidoc[]

:lucene_version: 8.9.0
:lucene_version_path: 8_9_0
:lucene_version: 9.0.0
:lucene_version_path: 9_0_0
:jdk: 11.0.2
:jdk_major: 11
:build_flavor: default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
package org.elasticsearch.analysis.common;

import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.ClassicFilter;
import org.apache.lucene.analysis.classic.ClassicFilter;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
package org.elasticsearch.analysis.common;

import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.standard.ClassicTokenizer;
import org.apache.lucene.analysis.classic.ClassicTokenizer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.apache.lucene.analysis.cjk.CJKWidthFilter;
import org.apache.lucene.analysis.ckb.SoraniAnalyzer;
import org.apache.lucene.analysis.ckb.SoraniNormalizationFilter;
import org.apache.lucene.analysis.classic.ClassicFilter;
import org.apache.lucene.analysis.classic.ClassicTokenizer;
import org.apache.lucene.analysis.commongrams.CommonGramsFilter;
import org.apache.lucene.analysis.core.DecimalDigitFilter;
import org.apache.lucene.analysis.core.KeywordTokenizer;
Expand All @@ -40,6 +42,7 @@
import org.apache.lucene.analysis.de.GermanNormalizationFilter;
import org.apache.lucene.analysis.de.GermanStemFilter;
import org.apache.lucene.analysis.el.GreekAnalyzer;
import org.apache.lucene.analysis.email.UAX29URLEmailTokenizer;
import org.apache.lucene.analysis.en.EnglishAnalyzer;
import org.apache.lucene.analysis.en.KStemFilter;
import org.apache.lucene.analysis.en.PorterStemFilter;
Expand Down Expand Up @@ -89,10 +92,7 @@
import org.apache.lucene.analysis.ru.RussianAnalyzer;
import org.apache.lucene.analysis.shingle.ShingleFilter;
import org.apache.lucene.analysis.snowball.SnowballFilter;
import org.apache.lucene.analysis.standard.ClassicFilter;
import org.apache.lucene.analysis.standard.ClassicTokenizer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.analysis.standard.UAX29URLEmailTokenizer;
import org.apache.lucene.analysis.sv.SwedishAnalyzer;
import org.apache.lucene.analysis.th.ThaiAnalyzer;
import org.apache.lucene.analysis.th.ThaiTokenizer;
Expand Down Expand Up @@ -289,6 +289,7 @@ public TokenStream create(TokenStream tokenStream) {

};
});
filters.put("norwegiannormalization", NorwegianNormalizationFilterFactory::new);
filters.put("pattern_capture", requiresAnalysisSettings(PatternCaptureGroupTokenFilterFactory::new));
filters.put("pattern_replace", requiresAnalysisSettings(PatternReplaceTokenFilterFactory::new));
filters.put("persian_normalization", PersianNormalizationFilterFactory::new);
Expand All @@ -305,6 +306,7 @@ public TokenStream create(TokenStream tokenStream) {
filters.put("sorani_normalization", SoraniNormalizationFilterFactory::new);
filters.put("stemmer_override", requiresAnalysisSettings(StemmerOverrideTokenFilterFactory::new));
filters.put("stemmer", StemmerTokenFilterFactory::new);
filters.put("swedishminimalstem", SwedishMinimalStemFilterFactory::new);
filters.put("synonym", requiresAnalysisSettings(SynonymTokenFilterFactory::new));
filters.put("synonym_graph", requiresAnalysisSettings(SynonymGraphTokenFilterFactory::new));
filters.put("trim", TrimTokenFilterFactory::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,18 @@ public TokenStream create(TokenStream tokenStream) {

private Map<String, String> convertSettings(Settings settings) {
Map<String, String> settingMap = new HashMap<>();
settingMap.put("hashCount", settings.get("hash_count"));
settingMap.put("bucketCount", settings.get("bucket_count"));
settingMap.put("hashSetSize", settings.get("hash_set_size"));
settingMap.put("withRotation", settings.get("with_rotation"));
if (settings.hasValue("hash_count")) {
settingMap.put("hashCount", settings.get("hash_count"));
}
if (settings.hasValue("bucketCount")) {
settingMap.put("bucketCount", settings.get("bucket_count"));
}
if (settings.hasValue("hashSetSize")) {
settingMap.put("hashSetSize", settings.get("hash_set_size"));
}
if (settings.hasValue("with_rotation")) {
settingMap.put("withRotation", settings.get("with_rotation"));
}
return settingMap;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

package org.elasticsearch.analysis.common;

import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.no.NorwegianNormalizationFilter;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.analysis.AbstractTokenFilterFactory;
import org.elasticsearch.index.analysis.NormalizingTokenFilterFactory;

/**
* Factory for {@link NorwegianNormalizationFilter}
*/
public class NorwegianNormalizationFilterFactory extends AbstractTokenFilterFactory implements NormalizingTokenFilterFactory {

public NorwegianNormalizationFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
super(indexSettings, name, settings);
}

@Override
public TokenStream create(TokenStream tokenStream) {
return new NorwegianNormalizationFilter(tokenStream);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

package org.elasticsearch.analysis.common;

import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.sv.SwedishMinimalStemFilter;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.analysis.AbstractTokenFilterFactory;

/**
* Factory for {@link SwedishMinimalStemFilter}
*/
public class SwedishMinimalStemFilterFactory extends AbstractTokenFilterFactory {

public SwedishMinimalStemFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
super(indexSettings, name, settings);
}

@Override
public TokenStream create(TokenStream tokenStream) {
return new SwedishMinimalStemFilter(tokenStream);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
package org.elasticsearch.analysis.common;

import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.email.UAX29URLEmailTokenizer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.analysis.standard.UAX29URLEmailTokenizer;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.index.IndexSettings;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ protected Map<String, Class<?>> getTokenFilters() {
filters.put("latvianstem", StemmerTokenFilterFactory.class);
filters.put("norwegianlightstem", StemmerTokenFilterFactory.class);
filters.put("norwegianminimalstem", StemmerTokenFilterFactory.class);
filters.put("norwegiannormalization", NorwegianNormalizationFilterFactory.class);
filters.put("portuguesestem", StemmerTokenFilterFactory.class);
filters.put("portugueselightstem", StemmerTokenFilterFactory.class);
filters.put("portugueseminimalstem", StemmerTokenFilterFactory.class);
filters.put("russianlightstem", StemmerTokenFilterFactory.class);
filters.put("soranistem", StemmerTokenFilterFactory.class);
filters.put("spanishlightstem", StemmerTokenFilterFactory.class);
filters.put("swedishlightstem", StemmerTokenFilterFactory.class);
filters.put("swedishminimalstem", SwedishMinimalStemFilterFactory.class);
filters.put("stemmeroverride", StemmerOverrideTokenFilterFactory.class);
filters.put("kstem", KStemTokenFilterFactory.class);
filters.put("synonym", SynonymTokenFilterFactory.class);
Expand Down Expand Up @@ -212,7 +214,7 @@ protected Map<String, Class<?>> getPreConfiguredTokenizers() {
tokenizers.put("keyword", null);
tokenizers.put("lowercase", Void.class);
tokenizers.put("classic", null);
tokenizers.put("uax_url_email", org.apache.lucene.analysis.standard.UAX29URLEmailTokenizerFactory.class);
tokenizers.put("uax_url_email", org.apache.lucene.analysis.email.UAX29URLEmailTokenizerFactory.class);
tokenizers.put("path_hierarchy", null);
tokenizers.put("letter", null);
tokenizers.put("whitespace", null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,17 @@ public void setup() {
// that ignores position length attribute
expectedQueryWithUnigram= new BooleanQuery.Builder()
.add(
new SynonymQuery(
new Term("text_shingle_unigram", "foo"),
new Term("text_shingle_unigram", "foo bar")
), BooleanClause.Occur.SHOULD)
new SynonymQuery.Builder("text_shingle_unigram")
.addTerm(new Term("text_shingle_unigram", "foo"))
.addTerm(new Term("text_shingle_unigram", "foo bar"))
.build(),
BooleanClause.Occur.SHOULD)
.add(
new SynonymQuery(
new Term("text_shingle_unigram", "bar"),
new Term("text_shingle_unigram", "bar baz")
), BooleanClause.Occur.SHOULD)
new SynonymQuery.Builder("text_shingle_unigram")
.addTerm(new Term("text_shingle_unigram", "bar"))
.addTerm(new Term("text_shingle_unigram", "bar baz"))
.build(),
BooleanClause.Occur.SHOULD)
.add(
new TermQuery(
new Term("text_shingle_unigram", "baz")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
42eaef59486b8d205136510bb4adbcda64b07ff9
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.apache.lucene.expressions.js.JavascriptCompiler;
import org.apache.lucene.expressions.js.VariableContext;
import org.apache.lucene.search.DoubleValuesSource;
import org.apache.lucene.search.SortField;
import org.elasticsearch.SpecialPermission;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.index.fielddata.IndexFieldData;
Expand Down Expand Up @@ -232,7 +231,7 @@ private static NumberSortScript.LeafFactory newSortScript(Expression expr, Searc
for (String variable : expr.variables) {
try {
if (variable.equals("_score")) {
bindings.add(new SortField("_score", SortField.Type.SCORE));
bindings.add("_score", DoubleValuesSource.SCORES);
needsScores = true;
} else if (vars != null && vars.containsKey(variable)) {
bindFromParams(vars, bindings, variable);
Expand Down Expand Up @@ -283,7 +282,7 @@ private static AggregationScript.LeafFactory newAggregationScript(Expression exp
for (String variable : expr.variables) {
try {
if (variable.equals("_score")) {
bindings.add(new SortField("_score", SortField.Type.SCORE));
bindings.add("_score", DoubleValuesSource.SCORES);
needsScores = true;
} else if (variable.equals("_value")) {
specialValue = new ReplaceableConstDoubleValueSource();
Expand Down Expand Up @@ -355,7 +354,7 @@ private static ScoreScript.LeafFactory newScoreScript(Expression expr, SearchLoo
for (String variable : expr.variables) {
try {
if (variable.equals("_score")) {
bindings.add(new SortField("_score", SortField.Type.SCORE));
bindings.add("_score", DoubleValuesSource.SCORES);
needsScores = true;
} else if (variable.equals("_value")) {
specialValue = new ReplaceableConstDoubleValueSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.Term;
import org.apache.lucene.queries.spans.FieldMaskingSpanQuery;
import org.apache.lucene.queries.spans.SpanMultiTermQueryWrapper;
import org.apache.lucene.queries.spans.SpanQuery;
import org.apache.lucene.queries.spans.SpanTermQuery;
import org.apache.lucene.search.AutomatonQuery;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
Expand All @@ -28,10 +32,6 @@
import org.apache.lucene.search.PrefixQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.spans.FieldMaskingSpanQuery;
import org.apache.lucene.search.spans.SpanMultiTermQueryWrapper;
import org.apache.lucene.search.spans.SpanQuery;
import org.apache.lucene.search.spans.SpanTermQuery;
import org.apache.lucene.util.automaton.Automata;
import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.Operations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ public int hashCode() {
return 31 * Objects.hash(in, valueFetcherProvider, indexAnalyzer) + classHash();
}

@Override
public void visit(QueryVisitor visitor) {
in.visit(visitor.getSubVisitor(Occur.MUST, this));
}

@Override
public Query rewrite(IndexReader reader) throws IOException {
Query inRewritten = in.rewrite(reader);
Expand Down Expand Up @@ -244,11 +249,6 @@ public boolean isCacheable(LeafReaderContext ctx) {
return false;
}

@Override
public void extractTerms(Set<Term> termSet) {
termSet.addAll(terms);
}

@Override
public Explanation explain(LeafReaderContext context, int doc) throws IOException {
RuntimePhraseScorer scorer = scorer(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.IndexableFieldType;
import org.apache.lucene.index.Term;
import org.apache.lucene.queries.spans.FieldMaskingSpanQuery;
import org.apache.lucene.queries.spans.SpanNearQuery;
import org.apache.lucene.queries.spans.SpanTermQuery;
import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
Expand All @@ -26,9 +29,6 @@
import org.apache.lucene.search.Query;
import org.apache.lucene.search.SynonymQuery;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.spans.FieldMaskingSpanQuery;
import org.apache.lucene.search.spans.SpanNearQuery;
import org.apache.lucene.search.spans.SpanTermQuery;
import org.elasticsearch.common.lucene.search.MultiPhrasePrefixQuery;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.IndexSettings;
Expand Down
Loading