From 22822a27806b71e7fb1fb828829309ff50e5da04 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Tue, 17 Nov 2020 15:09:09 -0800 Subject: [PATCH 1/2] Remove unnecessary references in mapping code. --- .../index/mapper/CompletionFieldMapper.java | 4 ++-- .../elasticsearch/index/mapper/DocumentMapper.java | 1 - .../index/mapper/DocumentMapperParser.java | 12 +++++------- .../java/org/elasticsearch/index/mapper/Mapping.java | 10 +++------- .../org/elasticsearch/index/mapper/ObjectMapper.java | 5 ++--- .../elasticsearch/index/mapper/RuntimeFieldType.java | 2 +- .../elasticsearch/index/mapper/TextFieldMapper.java | 4 ++-- .../org/elasticsearch/index/mapper/TypeParsers.java | 2 +- .../completion/context/CategoryContextMapping.java | 3 +-- .../suggest/completion/context/ContextMappings.java | 11 +++++------ .../action/bulk/TransportShardBulkActionTests.java | 6 +++--- .../action/index/MappingUpdatedActionTests.java | 2 +- 12 files changed, 26 insertions(+), 36 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/index/mapper/CompletionFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/CompletionFieldMapper.java index a08f9862aa452..df4a49b68094c 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/CompletionFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/CompletionFieldMapper.java @@ -67,7 +67,7 @@ *
  • "min_input_length": 50 (default)
  • *
  • "contexts" : CONTEXTS
  • * - * see {@link ContextMappings#load(Object, Version)} for CONTEXTS
    + * see {@link ContextMappings#load(Object)} for CONTEXTS
    * see {@link #parse(ParseContext)} for acceptable inputs for indexing
    *

    * This field type constructs completion queries that are run @@ -128,7 +128,7 @@ public static class Builder extends FieldMapper.Builder { m -> builder(m).preservePosInc.get(), Defaults.DEFAULT_POSITION_INCREMENTS) .alwaysSerialize(); private final Parameter contexts = new Parameter<>("contexts", false, () -> null, - (n, c, o) -> ContextMappings.load(o, c.indexVersionCreated()), m -> builder(m).contexts.get()) + (n, c, o) -> ContextMappings.load(o), m -> builder(m).contexts.get()) .setSerializer((b, n, c) -> { if (c == null) { return; diff --git a/server/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java index 255b963ece1bf..9e31860a70f28 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java @@ -87,7 +87,6 @@ public Builder put(MetadataFieldMapper.Builder mapper) { public DocumentMapper build() { Objects.requireNonNull(rootObjectMapper, "Mapper builder must have the root object mapper set"); Mapping mapping = new Mapping( - indexSettings.getIndexVersionCreated(), rootObjectMapper, metadataMappers.values().toArray(new MetadataFieldMapper[0]), meta); diff --git a/server/src/main/java/org/elasticsearch/index/mapper/DocumentMapperParser.java b/server/src/main/java/org/elasticsearch/index/mapper/DocumentMapperParser.java index 6fd9328a8686f..bc9e62abf25f1 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/DocumentMapperParser.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/DocumentMapperParser.java @@ -19,7 +19,6 @@ package org.elasticsearch.index.mapper; -import org.elasticsearch.Version; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.compress.CompressedXContent; import org.elasticsearch.common.xcontent.XContentHelper; @@ -110,7 +109,7 @@ private DocumentMapper parse(String type, Map mapping) throws Ma Map fieldNodeMap = (Map) fieldNode; docBuilder.put(typeParser.parse(fieldName, fieldNodeMap, parserContext)); fieldNodeMap.remove("type"); - checkNoRemainingFields(fieldName, fieldNodeMap, parserContext.indexVersionCreated()); + checkNoRemainingFields(fieldName, fieldNodeMap); } } @@ -133,17 +132,16 @@ private DocumentMapper parse(String type, Map mapping) throws Ma docBuilder.meta(Collections.unmodifiableMap(new HashMap<>(meta))); } - checkNoRemainingFields(mapping, parserContext.indexVersionCreated(), "Root mapping definition has unsupported parameters: "); + checkNoRemainingFields(mapping, "Root mapping definition has unsupported parameters: "); return docBuilder.build(); } - public static void checkNoRemainingFields(String fieldName, Map fieldNodeMap, Version indexVersionCreated) { - checkNoRemainingFields(fieldNodeMap, indexVersionCreated, - "Mapping definition for [" + fieldName + "] has unsupported parameters: "); + public static void checkNoRemainingFields(String fieldName, Map fieldNodeMap) { + checkNoRemainingFields(fieldNodeMap, "Mapping definition for [" + fieldName + "] has unsupported parameters: "); } - public static void checkNoRemainingFields(Map fieldNodeMap, Version indexVersionCreated, String message) { + public static void checkNoRemainingFields(Map fieldNodeMap, String message) { if (!fieldNodeMap.isEmpty()) { throw new MapperParsingException(message + getRemainingFields(fieldNodeMap)); } diff --git a/server/src/main/java/org/elasticsearch/index/mapper/Mapping.java b/server/src/main/java/org/elasticsearch/index/mapper/Mapping.java index b36d240be0b73..45ff673397c7d 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/Mapping.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/Mapping.java @@ -19,7 +19,6 @@ package org.elasticsearch.index.mapper; -import org.elasticsearch.Version; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContentFragment; @@ -44,16 +43,13 @@ */ public final class Mapping implements ToXContentFragment { - final Version indexCreated; final RootObjectMapper root; final MetadataFieldMapper[] metadataMappers; final Map, MetadataFieldMapper> metadataMappersMap; final Map metadataMappersByName; final Map meta; - public Mapping(Version indexCreated, RootObjectMapper rootObjectMapper, - MetadataFieldMapper[] metadataMappers, Map meta) { - this.indexCreated = indexCreated; + public Mapping(RootObjectMapper rootObjectMapper, MetadataFieldMapper[] metadataMappers, Map meta) { this.metadataMappers = metadataMappers; Map, MetadataFieldMapper> metadataMappersMap = new HashMap<>(); Map metadataMappersByName = new HashMap<>(); @@ -90,7 +86,7 @@ public void validate(MappingLookup mappers) { * Generate a mapping update for the given root object mapper. */ public Mapping mappingUpdate(Mapper rootObjectMapper) { - return new Mapping(indexCreated, (RootObjectMapper) rootObjectMapper, metadataMappers, meta); + return new Mapping((RootObjectMapper) rootObjectMapper, metadataMappers, meta); } /** Get the root mapper with the given class. */ @@ -137,7 +133,7 @@ public Mapping merge(Mapping mergeWith, MergeReason reason) { XContentHelper.mergeDefaults(mergedMeta, meta); } - return new Mapping(indexCreated, mergedRoot, mergedMetadataMappers.values().toArray(new MetadataFieldMapper[0]), mergedMeta); + return new Mapping(mergedRoot, mergedMetadataMappers.values().toArray(new MetadataFieldMapper[0]), mergedMeta); } public MetadataFieldMapper getMetadataMapper(String mapperName) { diff --git a/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java index 35a89c8425ed2..77835af296432 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/ObjectMapper.java @@ -321,7 +321,7 @@ protected static void parseProperties(ObjectMapper.Builder objBuilder, Map node, } runtimeFieldTypeConsumer.accept(typeParser.parse(fieldName, propNode, parserContext)); propNode.remove("type"); - DocumentMapperParser.checkNoRemainingFields(fieldName, propNode, parserContext.indexVersionCreated()); + DocumentMapperParser.checkNoRemainingFields(fieldName, propNode); iterator.remove(); } else { throw new MapperParsingException("Expected map for runtime field [" + fieldName + "] definition but got a " diff --git a/server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java index 1d2a40eb53fa8..e7a7be18c5f68 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/TextFieldMapper.java @@ -177,7 +177,7 @@ private static PrefixConfig parsePrefixConfig(String propName, ParserContext par Defaults.INDEX_PREFIX_MIN_CHARS); int maxChars = XContentMapValues.nodeIntegerValue(indexPrefix.remove("max_chars"), Defaults.INDEX_PREFIX_MAX_CHARS); - DocumentMapperParser.checkNoRemainingFields(propName, indexPrefix, parserContext.indexVersionCreated()); + DocumentMapperParser.checkNoRemainingFields(propName, indexPrefix); return new PrefixConfig(minChars, maxChars); } @@ -232,7 +232,7 @@ private static FielddataFrequencyFilter parseFrequencyFilter(String name, Parser double minFrequency = XContentMapValues.nodeDoubleValue(frequencyFilter.remove("min"), 0); double maxFrequency = XContentMapValues.nodeDoubleValue(frequencyFilter.remove("max"), Integer.MAX_VALUE); int minSegmentSize = XContentMapValues.nodeIntegerValue(frequencyFilter.remove("min_segment_size"), 0); - DocumentMapperParser.checkNoRemainingFields(name, frequencyFilter, parserContext.indexVersionCreated()); + DocumentMapperParser.checkNoRemainingFields(name, frequencyFilter); return new FielddataFrequencyFilter(minFrequency, maxFrequency, minSegmentSize); } diff --git a/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java b/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java index 29ae3e31ff197..2f0a1733cb536 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java @@ -155,7 +155,7 @@ public static boolean parseMultiField(Consumer multiFieldsB FieldMapper.TypeParser fieldTypeParser = (FieldMapper.TypeParser) typeParser; multiFieldsBuilder.accept(fieldTypeParser.parse(multiFieldName, multiFieldNodes, parserContext)); multiFieldNodes.remove("type"); - DocumentMapperParser.checkNoRemainingFields(propName, multiFieldNodes, parserContext.indexVersionCreated()); + DocumentMapperParser.checkNoRemainingFields(propName, multiFieldNodes); } return true; } diff --git a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryContextMapping.java b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryContextMapping.java index feadc41807154..2d3a830d09100 100644 --- a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryContextMapping.java +++ b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/CategoryContextMapping.java @@ -24,7 +24,6 @@ import org.apache.lucene.document.StoredField; import org.apache.lucene.index.IndexableField; import org.elasticsearch.ElasticsearchParseException; -import org.elasticsearch.Version; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser.Token; @@ -78,7 +77,7 @@ public String getFieldName() { /** * Loads a named {@link CategoryContextMapping} instance * from a map. - * see {@link ContextMappings#load(Object, Version)} + * see {@link ContextMappings#load(Object)} * * Acceptable map param: path */ diff --git a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMappings.java b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMappings.java index 7ebb62806ff80..52654738cd697 100644 --- a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMappings.java +++ b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/ContextMappings.java @@ -25,7 +25,6 @@ import org.apache.lucene.util.CharsRef; import org.apache.lucene.util.CharsRefBuilder; import org.elasticsearch.ElasticsearchParseException; -import org.elasticsearch.Version; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.mapper.CompletionFieldMapper; @@ -224,26 +223,26 @@ public Map> getNamedContexts(List contexts) { * [{"name": .., "type": .., ..}, {..}] * */ - public static ContextMappings load(Object configuration, Version indexVersionCreated) throws ElasticsearchParseException { + public static ContextMappings load(Object configuration) throws ElasticsearchParseException { final List> contextMappings; if (configuration instanceof List) { contextMappings = new ArrayList<>(); List configurations = (List) configuration; for (Object contextConfig : configurations) { - contextMappings.add(load((Map) contextConfig, indexVersionCreated)); + contextMappings.add(load((Map) contextConfig)); } if (contextMappings.size() == 0) { throw new ElasticsearchParseException("expected at least one context mapping"); } } else if (configuration instanceof Map) { - contextMappings = Collections.singletonList(load(((Map) configuration), indexVersionCreated)); + contextMappings = Collections.singletonList(load(((Map) configuration))); } else { throw new ElasticsearchParseException("expected a list or an entry of context mapping"); } return new ContextMappings(contextMappings); } - private static ContextMapping load(Map contextConfig, Version indexVersionCreated) { + private static ContextMapping load(Map contextConfig) { String name = extractRequiredValue(contextConfig, FIELD_NAME); String type = extractRequiredValue(contextConfig, FIELD_TYPE); final ContextMapping contextMapping; @@ -257,7 +256,7 @@ private static ContextMapping load(Map contextConfig, Version default: throw new ElasticsearchParseException("unknown context type[" + type + "]"); } - DocumentMapperParser.checkNoRemainingFields(name, contextConfig, indexVersionCreated); + DocumentMapperParser.checkNoRemainingFields(name, contextConfig); return contextMapping; } diff --git a/server/src/test/java/org/elasticsearch/action/bulk/TransportShardBulkActionTests.java b/server/src/test/java/org/elasticsearch/action/bulk/TransportShardBulkActionTests.java index 2f3f6cacdd58b..aa7e08328927a 100644 --- a/server/src/test/java/org/elasticsearch/action/bulk/TransportShardBulkActionTests.java +++ b/server/src/test/java/org/elasticsearch/action/bulk/TransportShardBulkActionTests.java @@ -242,7 +242,7 @@ public void testExecuteBulkIndexRequestWithMappingUpdates() throws Exception { new BulkShardRequest(shardId, RefreshPolicy.NONE, items); Engine.IndexResult mappingUpdate = - new Engine.IndexResult(new Mapping(null, mock(RootObjectMapper.class), new MetadataFieldMapper[0], Collections.emptyMap())); + new Engine.IndexResult(new Mapping(mock(RootObjectMapper.class), new MetadataFieldMapper[0], Collections.emptyMap())); Translog.Location resultLocation = new Translog.Location(42, 42, 42); Engine.IndexResult success = new FakeIndexResult(1, 1, 13, true, resultLocation); @@ -771,7 +771,7 @@ public void testRetries() throws Exception { "I'm conflicted <(;_;)>"); Engine.IndexResult conflictedResult = new Engine.IndexResult(err, 0); Engine.IndexResult mappingUpdate = - new Engine.IndexResult(new Mapping(null, mock(RootObjectMapper.class), new MetadataFieldMapper[0], Collections.emptyMap())); + new Engine.IndexResult(new Mapping(mock(RootObjectMapper.class), new MetadataFieldMapper[0], Collections.emptyMap())); Translog.Location resultLocation = new Translog.Location(42, 42, 42); Engine.IndexResult success = new FakeIndexResult(1, 1, 13, true, resultLocation); @@ -851,7 +851,7 @@ public void testForceExecutionOnRejectionAfterMappingUpdate() throws Exception { BulkShardRequest bulkShardRequest = new BulkShardRequest(shardId, RefreshPolicy.NONE, items); Engine.IndexResult mappingUpdate = - new Engine.IndexResult(new Mapping(null, mock(RootObjectMapper.class), new MetadataFieldMapper[0], Collections.emptyMap())); + new Engine.IndexResult(new Mapping(mock(RootObjectMapper.class), new MetadataFieldMapper[0], Collections.emptyMap())); Translog.Location resultLocation1 = new Translog.Location(42, 36, 36); Translog.Location resultLocation2 = new Translog.Location(42, 42, 42); Engine.IndexResult success1 = new FakeIndexResult(1, 1, 10, true, resultLocation1); diff --git a/server/src/test/java/org/elasticsearch/cluster/action/index/MappingUpdatedActionTests.java b/server/src/test/java/org/elasticsearch/cluster/action/index/MappingUpdatedActionTests.java index ad258e1de8d26..4384d1d6fd964 100644 --- a/server/src/test/java/org/elasticsearch/cluster/action/index/MappingUpdatedActionTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/action/index/MappingUpdatedActionTests.java @@ -155,7 +155,7 @@ public void testSendUpdateMappingUsingAutoPutMappingAction() { mua.setClient(client); RootObjectMapper rootObjectMapper = new RootObjectMapper.Builder("name", Version.CURRENT).build(new ContentPath()); - Mapping update = new Mapping(Version.V_7_9_0, rootObjectMapper, new MetadataFieldMapper[0], Map.of()); + Mapping update = new Mapping(rootObjectMapper, new MetadataFieldMapper[0], Map.of()); mua.sendUpdateMapping(new Index("name", "uuid"), update, ActionListener.wrap(() -> {})); verify(indicesAdminClient).execute(eq(AutoPutMappingAction.INSTANCE), any(), any()); From 3a99be8cb3ba2e267be26b085d29e258a9435303 Mon Sep 17 00:00:00 2001 From: Julie Tibshirani Date: Mon, 23 Nov 2020 14:31:15 -0800 Subject: [PATCH 2/2] Remove version from QueryAnalyzer#analyze. --- .../percolator/PercolatorFieldMapper.java | 3 +- .../percolator/QueryAnalyzer.java | 4 +- .../percolator/QueryAnalyzerTests.java | 229 +++++++++--------- 3 files changed, 116 insertions(+), 120 deletions(-) diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java index 5297060a24990..75e5e0574766e 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolatorFieldMapper.java @@ -395,8 +395,7 @@ void processQuery(Query query, ParseContext context) { ParseContext.Document doc = context.doc(); PercolatorFieldType pft = (PercolatorFieldType) this.fieldType(); QueryAnalyzer.Result result; - Version indexVersion = context.indexSettings().getIndexVersionCreated(); - result = QueryAnalyzer.analyze(query, indexVersion); + result = QueryAnalyzer.analyze(query); if (result == QueryAnalyzer.Result.UNKNOWN) { doc.add(new Field(pft.extractionResultField.name(), EXTRACTION_FAILED, INDEXED_KEYWORD)); return; diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/QueryAnalyzer.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/QueryAnalyzer.java index 041d45a9e0b78..d5899aee939f8 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/QueryAnalyzer.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/QueryAnalyzer.java @@ -40,7 +40,6 @@ import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.NumericUtils; import org.apache.lucene.util.automaton.ByteRunAutomaton; -import org.elasticsearch.Version; import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery; import org.elasticsearch.index.query.DateRangeIncludingNowQuery; @@ -84,9 +83,8 @@ private QueryAnalyzer() { * this query in such a way that the PercolatorQuery always verifies if this query with the MemoryIndex. * * @param query The query to analyze. - * @param indexVersion The create version of the index containing the percolator queries. */ - static Result analyze(Query query, Version indexVersion) { + static Result analyze(Query query) { ResultBuilder builder = new ResultBuilder(false); query.visit(builder); return builder.getResult(); diff --git a/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryAnalyzerTests.java b/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryAnalyzerTests.java index 6fb5b44d957aa..c8108ad94f2bd 100644 --- a/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryAnalyzerTests.java +++ b/modules/percolator/src/test/java/org/elasticsearch/percolator/QueryAnalyzerTests.java @@ -55,7 +55,6 @@ import org.apache.lucene.search.spans.SpanOrQuery; import org.apache.lucene.search.spans.SpanTermQuery; import org.apache.lucene.util.BytesRef; -import org.elasticsearch.Version; import org.elasticsearch.common.lucene.search.function.CombineFunction; import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery; import org.elasticsearch.common.lucene.search.function.RandomScoreFunction; @@ -83,7 +82,7 @@ public class QueryAnalyzerTests extends ESTestCase { public void testExtractQueryMetadata_termQuery() { TermQuery termQuery = new TermQuery(new Term("_field", "_term")); - Result result = analyze(termQuery, Version.CURRENT); + Result result = analyze(termQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); List terms = new ArrayList<>(result.extractions); @@ -94,7 +93,7 @@ public void testExtractQueryMetadata_termQuery() { public void testExtractQueryMetadata_termsQuery() { TermInSetQuery termsQuery = new TermInSetQuery("_field", new BytesRef("_term1"), new BytesRef("_term2")); - Result result = analyze(termsQuery, Version.CURRENT); + Result result = analyze(termsQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); List terms = new ArrayList<>(result.extractions); @@ -108,7 +107,7 @@ public void testExtractQueryMetadata_termsQuery() { public void testExtractQueryMetadata_phraseQuery() { PhraseQuery phraseQuery = new PhraseQuery("_field", "_term1", "term2"); - Result result = analyze(phraseQuery, Version.CURRENT); + Result result = analyze(phraseQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(2)); List terms = new ArrayList<>(result.extractions); @@ -127,7 +126,7 @@ public void testExtractQueryMetadata_multiPhraseQuery() { .add(new Term[] {new Term("_field", "_term4"), new Term("_field", "_term5")}) .add(new Term[] {new Term("_field", "_term6")}) .build(); - Result result = analyze(multiPhraseQuery, Version.CURRENT); + Result result = analyze(multiPhraseQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(4)); List terms = new ArrayList<>(result.extractions); @@ -153,7 +152,7 @@ public void testExtractQueryMetadata_multiPhraseQuery_dups() { .add(new Term[] {new Term("_field", "_term1"), new Term("_field", "_term2")}) .build(); - Result result = analyze(multiPhraseQuery, Version.CURRENT); + Result result = analyze(multiPhraseQuery); assertFalse(result.matchAllDocs); assertFalse(result.verified); assertTermsEqual(result.extractions, new Term("_field", "_term1"), new Term("_field", "_term2")); @@ -176,7 +175,7 @@ public void testExtractQueryMetadata_booleanQuery() { builder.add(subBuilder.build(), BooleanClause.Occur.SHOULD); BooleanQuery booleanQuery = builder.build(); - Result result = analyze(booleanQuery, Version.CURRENT); + Result result = analyze(booleanQuery); assertThat("Should clause with phrase query isn't verified, so entire query can't be verified", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); List terms = new ArrayList<>(result.extractions); @@ -208,7 +207,7 @@ public void testExtractQueryMetadata_booleanQuery_msm() { builder.add(termQuery3, BooleanClause.Occur.SHOULD); BooleanQuery booleanQuery = builder.build(); - Result result = analyze(booleanQuery, Version.CURRENT); + Result result = analyze(booleanQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(2)); assertTermsEqual(result.extractions, term1, term2, term3); @@ -221,7 +220,7 @@ public void testExtractQueryMetadata_booleanQuery_msm() { .add(termQuery3, Occur.SHOULD) .setMinimumNumberShouldMatch(2); booleanQuery = builder.build(); - result = analyze(booleanQuery, Version.CURRENT); + result = analyze(booleanQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(2)); assertTermsEqual(result.extractions, term1, term2, term3); @@ -238,7 +237,7 @@ public void testExtractQueryMetadata_booleanQuery_msm() { .add(termQuery4, Occur.FILTER) .build(), Occur.SHOULD); booleanQuery = builder.build(); - result = analyze(booleanQuery, Version.CURRENT); + result = analyze(booleanQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(2)); assertTermsEqual(result.extractions, term1, term2, term3, term4); @@ -247,21 +246,21 @@ public void testExtractQueryMetadata_booleanQuery_msm() { TermQuery termQuery5 = new TermQuery(term5); builder.add(termQuery5, Occur.SHOULD); booleanQuery = builder.build(); - result = analyze(booleanQuery, Version.CURRENT); + result = analyze(booleanQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, term1, term2, term3, term4, term5); builder.setMinimumNumberShouldMatch(2); booleanQuery = builder.build(); - result = analyze(booleanQuery, Version.CURRENT); + result = analyze(booleanQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(3)); assertTermsEqual(result.extractions, term1, term2, term3, term4, term5); builder.setMinimumNumberShouldMatch(3); booleanQuery = builder.build(); - result = analyze(booleanQuery, Version.CURRENT); + result = analyze(booleanQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(5)); assertTermsEqual(result.extractions, term1, term2, term3, term4, term5); @@ -274,7 +273,7 @@ public void testExtractQueryMetadata_booleanQuery_msm() { .add(new BooleanQuery.Builder().setMinimumNumberShouldMatch(1).build(), Occur.SHOULD) .setMinimumNumberShouldMatch(2); booleanQuery = builder.build(); - result = analyze(booleanQuery, Version.CURRENT); + result = analyze(booleanQuery); // ideally it would return no extractions, but the fact // that it doesn't consider them verified is probably good enough assertFalse(result.verified); @@ -295,7 +294,7 @@ public void testExtractQueryMetadata_booleanQuery_onlyShould() { builder.add(subBuilder.build(), BooleanClause.Occur.SHOULD); BooleanQuery booleanQuery = builder.build(); - Result result = analyze(booleanQuery, Version.CURRENT); + Result result = analyze(booleanQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); List terms = new ArrayList<>(result.extractions); @@ -319,7 +318,7 @@ public void testExtractQueryMetadata_booleanQueryWithMustNot() { builder.add(phraseQuery, BooleanClause.Occur.SHOULD); BooleanQuery booleanQuery = builder.build(); - Result result = analyze(booleanQuery, Version.CURRENT); + Result result = analyze(booleanQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(2)); assertTermsEqual(result.extractions, phraseQuery.getTerms()); @@ -328,7 +327,7 @@ public void testExtractQueryMetadata_booleanQueryWithMustNot() { builder.add(termQuery1, BooleanClause.Occur.MUST_NOT); builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST); booleanQuery = builder.build(); - result = analyze(booleanQuery, Version.CURRENT); + result = analyze(booleanQuery); assertThat(result.matchAllDocs, is(true)); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(0)); @@ -341,7 +340,7 @@ public void testExactMatch_booleanQuery() { builder.add(termQuery1, BooleanClause.Occur.SHOULD); TermQuery termQuery2 = new TermQuery(new Term("_field", "_term2")); builder.add(termQuery2, BooleanClause.Occur.SHOULD); - Result result = analyze(builder.build(), Version.CURRENT); + Result result = analyze(builder.build()); assertThat("All clauses are exact, so candidate matches are verified", result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); @@ -349,7 +348,7 @@ public void testExactMatch_booleanQuery() { builder.add(termQuery1, BooleanClause.Occur.SHOULD); PhraseQuery phraseQuery1 = new PhraseQuery("_field", "_term1", "_term2"); builder.add(phraseQuery1, BooleanClause.Occur.SHOULD); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Clause isn't exact, so candidate matches are not verified", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); @@ -357,14 +356,14 @@ public void testExactMatch_booleanQuery() { builder.add(phraseQuery1, BooleanClause.Occur.SHOULD); PhraseQuery phraseQuery2 = new PhraseQuery("_field", "_term3", "_term4"); builder.add(phraseQuery2, BooleanClause.Occur.SHOULD); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("No clause is exact, so candidate matches are not verified", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(2)); builder = new BooleanQuery.Builder(); builder.add(termQuery1, BooleanClause.Occur.MUST_NOT); builder.add(termQuery2, BooleanClause.Occur.SHOULD); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("There is a must_not clause, so candidate matches are not verified", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); @@ -375,34 +374,34 @@ public void testExactMatch_booleanQuery() { builder.add(termQuery1, BooleanClause.Occur.SHOULD); builder.add(termQuery2, BooleanClause.Occur.SHOULD); builder.add(termQuery3, BooleanClause.Occur.SHOULD); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Minimum match has no impact on whether the result is verified", result.verified, is(true)); assertThat("msm is at least two so result.minimumShouldMatch should 2 too", result.minimumShouldMatch, equalTo(msm)); builder = new BooleanQuery.Builder(); builder.add(termQuery1, randomBoolean() ? BooleanClause.Occur.MUST : BooleanClause.Occur.FILTER); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Also required clauses are taken into account whether the result is verified", result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); builder = new BooleanQuery.Builder(); builder.add(termQuery1, randomBoolean() ? BooleanClause.Occur.MUST : BooleanClause.Occur.FILTER); builder.add(termQuery2, randomBoolean() ? BooleanClause.Occur.MUST : BooleanClause.Occur.FILTER); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Also required clauses are taken into account whether the result is verified", result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(2)); builder = new BooleanQuery.Builder(); builder.add(termQuery1, randomBoolean() ? BooleanClause.Occur.MUST : BooleanClause.Occur.FILTER); builder.add(termQuery2, BooleanClause.Occur.MUST_NOT); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Prohibited clause, so candidate matches are not verified", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); builder = new BooleanQuery.Builder(); builder.add(termQuery1, randomBoolean() ? BooleanClause.Occur.MUST : BooleanClause.Occur.FILTER); builder.add(termQuery2, BooleanClause.Occur.MUST_NOT); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Prohibited clause, so candidate matches are not verified", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); @@ -412,7 +411,7 @@ public void testExactMatch_booleanQuery() { .add(termQuery2, Occur.FILTER) .build(), Occur.SHOULD) .add(termQuery3, Occur.SHOULD); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Inner clause that is not a pure disjunction, so candidate matches are not verified", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); @@ -422,7 +421,7 @@ public void testExactMatch_booleanQuery() { .add(termQuery2, Occur.SHOULD) .build(), Occur.SHOULD) .add(termQuery3, Occur.SHOULD); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Inner clause that is a pure disjunction, so candidate matches are verified", result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); @@ -432,7 +431,7 @@ public void testExactMatch_booleanQuery() { .add(termQuery2, Occur.SHOULD) .build(), Occur.MUST) .add(termQuery3, Occur.FILTER); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Disjunctions of conjunctions can't be verified", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(2)); @@ -442,7 +441,7 @@ public void testExactMatch_booleanQuery() { .add(termQuery2, Occur.FILTER) .build(), Occur.SHOULD) .add(termQuery3, Occur.SHOULD); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Conjunctions of disjunctions can't be verified", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); } @@ -455,7 +454,7 @@ public void testBooleanQueryWithMustAndShouldClauses() { builder.add(termQuery2, BooleanClause.Occur.SHOULD); TermQuery termQuery3 = new TermQuery(new Term("_field", "_term3")); builder.add(termQuery3, BooleanClause.Occur.MUST); - Result result = analyze(builder.build(), Version.CURRENT); + Result result = analyze(builder.build()); assertThat("Must clause is exact, so this is a verified candidate match", result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); assertThat(result.extractions.size(), equalTo(1)); @@ -463,7 +462,7 @@ public void testBooleanQueryWithMustAndShouldClauses() { assertThat(extractions.get(0).term, equalTo(new Term("_field", "_term3"))); builder.setMinimumNumberShouldMatch(1); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Must clause is exact, but m_s_m is 1 so one should clause must match too", result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(2)); assertTermsEqual(result.extractions, termQuery1.getTerm(), termQuery2.getTerm(), termQuery3.getTerm()); @@ -475,7 +474,7 @@ public void testBooleanQueryWithMustAndShouldClauses() { innerBuilder.add(termQuery2, BooleanClause.Occur.SHOULD); builder.add(innerBuilder.build(), BooleanClause.Occur.MUST); builder.add(termQuery3, BooleanClause.Occur.MUST); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Verified, because m_s_m is specified in an inner clause and not top level clause", result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(3)); assertThat(result.extractions.size(), equalTo(3)); @@ -488,7 +487,7 @@ public void testBooleanQueryWithMustAndShouldClauses() { builder = new BooleanQuery.Builder(); builder.add(innerBuilder.build(), BooleanClause.Occur.SHOULD); builder.add(termQuery3, BooleanClause.Occur.MUST); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat("Verified, because m_s_m is specified in an inner clause and not top level clause", result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); assertThat(result.extractions.size(), equalTo(1)); @@ -499,7 +498,7 @@ public void testBooleanQueryWithMustAndShouldClauses() { public void testExtractQueryMetadata_constantScoreQuery() { TermQuery termQuery1 = new TermQuery(new Term("_field", "_term")); ConstantScoreQuery constantScoreQuery = new ConstantScoreQuery(termQuery1); - Result result = analyze(constantScoreQuery, Version.CURRENT); + Result result = analyze(constantScoreQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); List terms = new ArrayList<>(result.extractions); @@ -511,7 +510,7 @@ public void testExtractQueryMetadata_constantScoreQuery() { public void testExtractQueryMetadata_boostQuery() { TermQuery termQuery1 = new TermQuery(new Term("_field", "_term")); BoostQuery constantScoreQuery = new BoostQuery(termQuery1, 1f); - Result result = analyze(constantScoreQuery, Version.CURRENT); + Result result = analyze(constantScoreQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); List terms = new ArrayList<>(result.extractions); @@ -523,7 +522,7 @@ public void testExtractQueryMetadata_boostQuery() { public void testExtractQueryMetadata_blendedTermQuery() { Term[] termsArr = new Term[]{new Term("_field", "_term1"), new Term("_field", "_term2")}; BlendedTermQuery blendedTermQuery = BlendedTermQuery.dismaxBlendedQuery(termsArr, 1.0f); - Result result = analyze(blendedTermQuery, Version.CURRENT); + Result result = analyze(blendedTermQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); List terms = new ArrayList<>(result.extractions); @@ -548,7 +547,7 @@ public void testExtractQueryMetadata_spanTermQuery() { // 4) FieldMaskingSpanQuery is a tricky query so we shouldn't optimize this SpanTermQuery spanTermQuery1 = new SpanTermQuery(new Term("_field", "_short_term")); - Result result = analyze(spanTermQuery1, Version.CURRENT); + Result result = analyze(spanTermQuery1); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, spanTermQuery1.getTerm()); @@ -560,7 +559,7 @@ public void testExtractQueryMetadata_spanNearQuery() { SpanNearQuery spanNearQuery = new SpanNearQuery.Builder("_field", true) .addClause(spanTermQuery1).addClause(spanTermQuery2).build(); - Result result = analyze(spanNearQuery, Version.CURRENT); + Result result = analyze(spanNearQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(2)); assertTermsEqual(result.extractions, spanTermQuery1.getTerm(), spanTermQuery2.getTerm()); @@ -570,7 +569,7 @@ public void testExtractQueryMetadata_spanOrQuery() { SpanTermQuery spanTermQuery1 = new SpanTermQuery(new Term("_field", "_short_term")); SpanTermQuery spanTermQuery2 = new SpanTermQuery(new Term("_field", "_very_long_term")); SpanOrQuery spanOrQuery = new SpanOrQuery(spanTermQuery1, spanTermQuery2); - Result result = analyze(spanOrQuery, Version.CURRENT); + Result result = analyze(spanOrQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, spanTermQuery1.getTerm(), spanTermQuery2.getTerm()); @@ -579,7 +578,7 @@ public void testExtractQueryMetadata_spanOrQuery() { public void testExtractQueryMetadata_spanFirstQuery() { SpanTermQuery spanTermQuery1 = new SpanTermQuery(new Term("_field", "_short_term")); SpanFirstQuery spanFirstQuery = new SpanFirstQuery(spanTermQuery1, 20); - Result result = analyze(spanFirstQuery, Version.CURRENT); + Result result = analyze(spanFirstQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, spanTermQuery1.getTerm()); @@ -589,14 +588,14 @@ public void testExtractQueryMetadata_spanNotQuery() { SpanTermQuery spanTermQuery1 = new SpanTermQuery(new Term("_field", "_short_term")); SpanTermQuery spanTermQuery2 = new SpanTermQuery(new Term("_field", "_very_long_term")); SpanNotQuery spanNotQuery = new SpanNotQuery(spanTermQuery1, spanTermQuery2); - Result result = analyze(spanNotQuery, Version.CURRENT); + Result result = analyze(spanNotQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, spanTermQuery1.getTerm()); } public void testExtractQueryMetadata_matchNoDocsQuery() { - Result result = analyze(new MatchNoDocsQuery("sometimes there is no reason at all"), Version.CURRENT); + Result result = analyze(new MatchNoDocsQuery("sometimes there is no reason at all")); assertThat(result.verified, is(true)); assertEquals(0, result.extractions.size()); assertThat(result.minimumShouldMatch, equalTo(0)); @@ -604,7 +603,7 @@ public void testExtractQueryMetadata_matchNoDocsQuery() { BooleanQuery.Builder bq = new BooleanQuery.Builder(); bq.add(new TermQuery(new Term("field", "value")), BooleanClause.Occur.MUST); bq.add(new MatchNoDocsQuery("sometimes there is no reason at all"), BooleanClause.Occur.MUST); - result = analyze(bq.build(), Version.CURRENT); + result = analyze(bq.build()); assertThat(result.verified, is(true)); assertEquals(0, result.extractions.size()); assertThat(result.minimumShouldMatch, equalTo(0)); @@ -612,7 +611,7 @@ public void testExtractQueryMetadata_matchNoDocsQuery() { bq = new BooleanQuery.Builder(); bq.add(new TermQuery(new Term("field", "value")), BooleanClause.Occur.SHOULD); bq.add(new MatchNoDocsQuery("sometimes there is no reason at all"), BooleanClause.Occur.SHOULD); - result = analyze(bq.build(), Version.CURRENT); + result = analyze(bq.build()); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, new Term("field", "value")); @@ -621,14 +620,14 @@ public void testExtractQueryMetadata_matchNoDocsQuery() { Arrays.asList(new TermQuery(new Term("field", "value")), new MatchNoDocsQuery("sometimes there is no reason at all")), 1f ); - result = analyze(disjunctionMaxQuery, Version.CURRENT); + result = analyze(disjunctionMaxQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, new Term("field", "value")); } public void testExtractQueryMetadata_matchAllDocsQuery() { - Result result = analyze(new MatchAllDocsQuery(), Version.CURRENT); + Result result = analyze(new MatchAllDocsQuery()); assertThat(result.verified, is(true)); assertThat(result.matchAllDocs, is(true)); assertThat(result.minimumShouldMatch, equalTo(0)); @@ -637,7 +636,7 @@ public void testExtractQueryMetadata_matchAllDocsQuery() { BooleanQuery.Builder builder = new BooleanQuery.Builder(); builder.add(new TermQuery(new Term("field", "value")), BooleanClause.Occur.MUST); builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat(result.verified, is(true)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); @@ -648,7 +647,7 @@ public void testExtractQueryMetadata_matchAllDocsQuery() { builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST); builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST); BooleanQuery bq1 = builder.build(); - result = analyze(bq1, Version.CURRENT); + result = analyze(bq1); assertThat(result.verified, is(true)); assertThat(result.matchAllDocs, is(true)); assertThat(result.minimumShouldMatch, equalTo(0)); @@ -659,7 +658,7 @@ public void testExtractQueryMetadata_matchAllDocsQuery() { builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST); builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.MUST); BooleanQuery bq2 = builder.build(); - result = analyze(bq2, Version.CURRENT); + result = analyze(bq2); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(true)); assertThat(result.minimumShouldMatch, equalTo(0)); @@ -670,7 +669,7 @@ public void testExtractQueryMetadata_matchAllDocsQuery() { builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD); builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD); BooleanQuery bq3 = builder.build(); - result = analyze(bq3, Version.CURRENT); + result = analyze(bq3); assertThat(result.verified, is(true)); assertThat(result.matchAllDocs, is(true)); assertThat(result.minimumShouldMatch, equalTo(0)); @@ -681,7 +680,7 @@ public void testExtractQueryMetadata_matchAllDocsQuery() { builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD); builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD); BooleanQuery bq4 = builder.build(); - result = analyze(bq4, Version.CURRENT); + result = analyze(bq4); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(true)); assertThat(result.minimumShouldMatch, equalTo(0)); @@ -691,7 +690,7 @@ public void testExtractQueryMetadata_matchAllDocsQuery() { builder.add(new TermQuery(new Term("field", "value")), BooleanClause.Occur.SHOULD); builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.SHOULD); BooleanQuery bq5 = builder.build(); - result = analyze(bq5, Version.CURRENT); + result = analyze(bq5); assertThat(result.verified, is(true)); assertThat(result.matchAllDocs, is(true)); assertThat(result.minimumShouldMatch, equalTo(0)); @@ -702,7 +701,7 @@ public void testExtractQueryMetadata_matchAllDocsQuery() { builder.add(new TermQuery(new Term("field", "value")), BooleanClause.Occur.SHOULD); builder.setMinimumNumberShouldMatch(2); BooleanQuery bq6 = builder.build(); - result = analyze(bq6, Version.CURRENT); + result = analyze(bq6); assertThat(result.verified, is(true)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); @@ -715,7 +714,7 @@ public void testExtractQueryMetadata_matchAllDocsQuery() { builder.add(new TermQuery(new Term("field", "value")), BooleanClause.Occur.SHOULD); builder.setMinimumNumberShouldMatch(2); BooleanQuery bq7 = builder.build(); - result = analyze(bq7, Version.CURRENT); + result = analyze(bq7); assertThat(result.verified, is(true)); assertThat(result.matchAllDocs, is(true)); assertThat(result.minimumShouldMatch, equalTo(0)); @@ -724,14 +723,14 @@ public void testExtractQueryMetadata_matchAllDocsQuery() { public void testExtractQueryMetadata_unsupportedQuery() { TermRangeQuery termRangeQuery = new TermRangeQuery("_field", null, null, true, false); - assertEquals(Result.UNKNOWN, analyze(termRangeQuery, Version.CURRENT)); + assertEquals(Result.UNKNOWN, analyze(termRangeQuery)); TermQuery termQuery1 = new TermQuery(new Term("_field", "_term")); BooleanQuery.Builder builder = new BooleanQuery.Builder(); builder.add(termQuery1, BooleanClause.Occur.SHOULD); builder.add(termRangeQuery, BooleanClause.Occur.SHOULD); BooleanQuery bq = builder.build(); - assertEquals(Result.UNKNOWN, analyze(bq, Version.CURRENT)); + assertEquals(Result.UNKNOWN, analyze(bq)); } public void testExtractQueryMetadata_unsupportedQueryInBoolQueryWithMustClauses() { @@ -743,7 +742,7 @@ public void testExtractQueryMetadata_unsupportedQueryInBoolQueryWithMustClauses( builder.add(unsupportedQuery, BooleanClause.Occur.MUST); BooleanQuery bq1 = builder.build(); - Result result = analyze(bq1, Version.CURRENT); + Result result = analyze(bq1); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, termQuery1.getTerm()); @@ -754,7 +753,7 @@ public void testExtractQueryMetadata_unsupportedQueryInBoolQueryWithMustClauses( builder.add(termQuery2, BooleanClause.Occur.MUST); builder.add(unsupportedQuery, BooleanClause.Occur.MUST); bq1 = builder.build(); - result = analyze(bq1, Version.CURRENT); + result = analyze(bq1); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(2)); assertTermsEqual(result.extractions, termQuery1.getTerm(), termQuery2.getTerm()); @@ -763,7 +762,7 @@ public void testExtractQueryMetadata_unsupportedQueryInBoolQueryWithMustClauses( builder.add(unsupportedQuery, BooleanClause.Occur.MUST); builder.add(unsupportedQuery, BooleanClause.Occur.MUST); BooleanQuery bq2 = builder.build(); - assertEquals(Result.UNKNOWN, analyze(bq2, Version.CURRENT)); + assertEquals(Result.UNKNOWN, analyze(bq2)); } public void testExtractQueryMetadata_disjunctionMaxQuery() { @@ -775,7 +774,7 @@ public void testExtractQueryMetadata_disjunctionMaxQuery() { Arrays.asList(termQuery1, termQuery2, termQuery3, termQuery4), 0.1f ); - Result result = analyze(disjunctionMaxQuery, Version.CURRENT); + Result result = analyze(disjunctionMaxQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); List terms = new ArrayList<>(result.extractions); @@ -794,7 +793,7 @@ public void testExtractQueryMetadata_disjunctionMaxQuery() { Arrays.asList(termQuery1, termQuery2, termQuery3, new PhraseQuery("_field", "_term4")), 0.1f ); - result = analyze(disjunctionMaxQuery, Version.CURRENT); + result = analyze(disjunctionMaxQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); terms = new ArrayList<>(result.extractions); @@ -812,13 +811,13 @@ public void testExtractQueryMetadata_disjunctionMaxQuery() { public void testSynonymQuery() { SynonymQuery query = new SynonymQuery(); - Result result = analyze(query, Version.CURRENT); + Result result = analyze(query); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(0)); assertThat(result.extractions.isEmpty(), is(true)); query = new SynonymQuery(new Term("_field", "_value1"), new Term("_field", "_value2")); - result = analyze(query, Version.CURRENT); + result = analyze(query); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, new Term("_field", "_value1"), new Term("_field", "_value2")); @@ -827,14 +826,14 @@ public void testSynonymQuery() { public void testFunctionScoreQuery() { TermQuery termQuery = new TermQuery(new Term("_field", "_value")); FunctionScoreQuery functionScoreQuery = new FunctionScoreQuery(termQuery, new RandomScoreFunction(0, 0, null)); - Result result = analyze(functionScoreQuery, Version.CURRENT); + Result result = analyze(functionScoreQuery); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, new Term("_field", "_value")); functionScoreQuery = new FunctionScoreQuery(termQuery, new RandomScoreFunction(0, 0, null), CombineFunction.MULTIPLY, 1f, 10f); - result = analyze(functionScoreQuery, Version.CURRENT); + result = analyze(functionScoreQuery); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, new Term("_field", "_value")); @@ -843,7 +842,7 @@ public void testFunctionScoreQuery() { public void testFunctionScoreQuery_withMatchAll() { MatchAllDocsQuery innerQuery = new MatchAllDocsQuery(); FunctionScoreQuery functionScoreQuery1 = new FunctionScoreQuery(innerQuery, new RandomScoreFunction(0, 0, null)); - Result result = analyze(functionScoreQuery1, Version.CURRENT); + Result result = analyze(functionScoreQuery1); assertThat(result.verified, is(true)); assertThat(result.minimumShouldMatch, equalTo(0)); assertThat(result.matchAllDocs, is(true)); @@ -851,7 +850,7 @@ public void testFunctionScoreQuery_withMatchAll() { FunctionScoreQuery functionScoreQuery2 = new FunctionScoreQuery(innerQuery, new RandomScoreFunction(0, 0, null), CombineFunction.MULTIPLY, 1f, 10f); - result = analyze(functionScoreQuery2, Version.CURRENT); + result = analyze(functionScoreQuery2); assertThat(result.verified, is(false)); assertThat(result.minimumShouldMatch, equalTo(0)); assertThat(result.matchAllDocs, is(true)); @@ -861,7 +860,7 @@ public void testFunctionScoreQuery_withMatchAll() { public void testPointRangeQuery() { // int ranges get converted to long ranges: Query query = IntPoint.newRangeQuery("_field", 10, 20); - Result result = analyze(query, Version.CURRENT); + Result result = analyze(query); assertFalse(result.verified); assertThat(result.minimumShouldMatch, equalTo(1)); List ranges = new ArrayList<>(result.extractions); @@ -872,7 +871,7 @@ public void testPointRangeQuery() { assertDimension(ranges.get(0).range.upperPoint, bytes -> IntPoint.encodeDimension(20, bytes, 0)); query = LongPoint.newRangeQuery("_field", 10L, 21L); - result = analyze(query, Version.CURRENT); + result = analyze(query); assertThat(result.minimumShouldMatch, equalTo(1)); assertFalse(result.verified); ranges = new ArrayList<>(result.extractions); @@ -884,7 +883,7 @@ public void testPointRangeQuery() { // Half float ranges get converted to double ranges: query = HalfFloatPoint.newRangeQuery("_field", 10F, 20F); - result = analyze(query, Version.CURRENT); + result = analyze(query); assertThat(result.minimumShouldMatch, equalTo(1)); assertFalse(result.verified); ranges = new ArrayList<>(result.extractions); @@ -896,7 +895,7 @@ public void testPointRangeQuery() { // Float ranges get converted to double ranges: query = FloatPoint.newRangeQuery("_field", 10F, 20F); - result = analyze(query, Version.CURRENT); + result = analyze(query); assertThat(result.minimumShouldMatch, equalTo(1)); assertFalse(result.verified); ranges = new ArrayList<>(result.extractions); @@ -907,7 +906,7 @@ public void testPointRangeQuery() { assertDimension(ranges.get(0).range.upperPoint, bytes -> FloatPoint.encodeDimension(20F, bytes, 0)); query = DoublePoint.newRangeQuery("_field", 10D, 20D); - result = analyze(query, Version.CURRENT); + result = analyze(query); assertThat(result.minimumShouldMatch, equalTo(1)); assertFalse(result.verified); ranges = new ArrayList<>(result.extractions); @@ -919,7 +918,7 @@ public void testPointRangeQuery() { query = InetAddressPoint.newRangeQuery("_field", InetAddresses.forString("192.168.1.0"), InetAddresses.forString("192.168.1.255")); - result = analyze(query, Version.CURRENT); + result = analyze(query); assertThat(result.minimumShouldMatch, equalTo(1)); assertFalse(result.verified); ranges = new ArrayList<>(result.extractions); @@ -933,15 +932,15 @@ public void testPointRangeQuery() { public void testTooManyPointDimensions() { // For now no extraction support for geo queries: Query query1 = LatLonPoint.newBoxQuery("_field", 0, 1, 0, 1); - assertEquals(Result.UNKNOWN, analyze(query1, Version.CURRENT)); + assertEquals(Result.UNKNOWN, analyze(query1)); Query query2 = LongPoint.newRangeQuery("_field", new long[]{0, 0, 0}, new long[]{1, 1, 1}); - assertEquals(Result.UNKNOWN, analyze(query2, Version.CURRENT)); + assertEquals(Result.UNKNOWN, analyze(query2)); } public void testPointRangeQuery_lowerUpperReversed() { Query query = IntPoint.newRangeQuery("_field", 20, 10); - Result result = analyze(query, Version.CURRENT); + Result result = analyze(query); assertTrue(result.verified); assertThat(result.minimumShouldMatch, equalTo(0)); assertThat(result.extractions.size(), equalTo(0)); @@ -950,7 +949,7 @@ public void testPointRangeQuery_lowerUpperReversed() { public void testIndexOrDocValuesQuery() { Query query = new IndexOrDocValuesQuery(IntPoint.newRangeQuery("_field", 10, 20), SortedNumericDocValuesField.newSlowRangeQuery("_field", 10, 20)); - Result result = analyze(query, Version.CURRENT); + Result result = analyze(query); assertFalse(result.verified); assertThat(result.minimumShouldMatch, equalTo(1)); List ranges = new ArrayList<>(result.extractions); @@ -965,7 +964,7 @@ public void testToParentBlockJoinQuery() { TermQuery termQuery = new TermQuery(new Term("field", "value")); QueryBitSetProducer queryBitSetProducer = new QueryBitSetProducer(new TermQuery(new Term("_type", "child"))); ESToParentBlockJoinQuery query = new ESToParentBlockJoinQuery(termQuery, queryBitSetProducer, ScoreMode.None, "child"); - Result result = analyze(query, Version.CURRENT); + Result result = analyze(query); assertFalse(result.verified); assertThat(result.minimumShouldMatch, equalTo(1)); assertEquals(1, result.extractions.size()); @@ -977,7 +976,7 @@ public void testPointRangeQuerySelectRanges() { BooleanQuery.Builder boolQuery = new BooleanQuery.Builder(); boolQuery.add(LongPoint.newRangeQuery("_field1", 10, 20), BooleanClause.Occur.SHOULD); boolQuery.add(LongPoint.newRangeQuery("_field2", 10, 15), BooleanClause.Occur.SHOULD); - Result result = analyze(boolQuery.build(), Version.CURRENT); + Result result = analyze(boolQuery.build()); assertFalse(result.verified); assertThat(result.minimumShouldMatch, equalTo(1)); assertEquals(2, result.extractions.size()); @@ -987,7 +986,7 @@ public void testPointRangeQuerySelectRanges() { boolQuery = new BooleanQuery.Builder(); boolQuery.add(LongPoint.newRangeQuery("_field1", 10, 20), BooleanClause.Occur.FILTER); boolQuery.add(LongPoint.newRangeQuery("_field2", 10, 15), BooleanClause.Occur.FILTER); - result = analyze(boolQuery.build(), Version.CURRENT); + result = analyze(boolQuery.build()); assertFalse(result.verified); assertThat(result.minimumShouldMatch, equalTo(2)); assertEquals(2, result.extractions.size()); @@ -997,7 +996,7 @@ public void testPointRangeQuerySelectRanges() { boolQuery = new BooleanQuery.Builder(); boolQuery.add(LongPoint.newRangeQuery("_field1", 10, 20), BooleanClause.Occur.FILTER); boolQuery.add(LongPoint.newRangeQuery("_field1", 10, 15), BooleanClause.Occur.FILTER); - result = analyze(boolQuery.build(), Version.CURRENT); + result = analyze(boolQuery.build()); assertFalse(result.verified); assertThat(result.minimumShouldMatch, equalTo(1)); assertEquals(2, result.extractions.size()); @@ -1007,7 +1006,7 @@ public void testPointRangeQuerySelectRanges() { boolQuery = new BooleanQuery.Builder().setMinimumNumberShouldMatch(2); boolQuery.add(LongPoint.newRangeQuery("_field1", 10, 20), BooleanClause.Occur.SHOULD); boolQuery.add(LongPoint.newRangeQuery("_field2", 10, 15), BooleanClause.Occur.SHOULD); - result = analyze(boolQuery.build(), Version.CURRENT); + result = analyze(boolQuery.build()); assertFalse(result.verified); assertThat(result.minimumShouldMatch, equalTo(1)); assertEquals(2, result.extractions.size()); @@ -1017,7 +1016,7 @@ public void testPointRangeQuerySelectRanges() { boolQuery = new BooleanQuery.Builder().setMinimumNumberShouldMatch(2); boolQuery.add(LongPoint.newRangeQuery("_field1", 10, 20), BooleanClause.Occur.SHOULD); boolQuery.add(LongPoint.newRangeQuery("_field1", 10, 15), BooleanClause.Occur.SHOULD); - result = analyze(boolQuery.build(), Version.CURRENT); + result = analyze(boolQuery.build()); assertFalse(result.verified); assertThat(result.minimumShouldMatch, equalTo(1)); assertEquals(2, result.extractions.size()); @@ -1048,7 +1047,7 @@ public void testExtractQueryMetadata_duplicatedClauses() { .build(), BooleanClause.Occur.MUST ); - Result result = analyze(builder.build(), Version.CURRENT); + Result result = analyze(builder.build()); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(4)); @@ -1077,7 +1076,7 @@ public void testExtractQueryMetadata_duplicatedClauses() { .build(), BooleanClause.Occur.SHOULD ); - result = analyze(builder.build(), Version.CURRENT); + result = analyze(builder.build()); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(2)); @@ -1087,10 +1086,10 @@ public void testExtractQueryMetadata_duplicatedClauses() { public void testEmptyQueries() { BooleanQuery.Builder builder = new BooleanQuery.Builder(); - Result result = analyze(builder.build(), Version.CURRENT); + Result result = analyze(builder.build()); assertEquals(result, Result.MATCH_NONE); - result = analyze(new DisjunctionMaxQuery(Collections.emptyList(), 0f), Version.CURRENT); + result = analyze(new DisjunctionMaxQuery(Collections.emptyList(), 0f)); assertEquals(result, Result.MATCH_NONE); } @@ -1106,7 +1105,7 @@ private static void assertTermsEqual(Set actual, Term... expect public void testIntervalQueries() { IntervalsSource source = Intervals.or(Intervals.term("term1"), Intervals.term("term2")); - Result result = analyze(new IntervalQuery("field", source), Version.CURRENT); + Result result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); @@ -1114,7 +1113,7 @@ public void testIntervalQueries() { source = Intervals.ordered(Intervals.term("term1"), Intervals.term("term2"), Intervals.or(Intervals.term("term3"), Intervals.term("term4"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(3)); @@ -1122,86 +1121,86 @@ public void testIntervalQueries() { new Term("field", "term3"), new Term("field", "term4")); source = Intervals.ordered(Intervals.term("term1"), Intervals.wildcard(new BytesRef("a*"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, new Term("field", "term1")); source = Intervals.ordered(Intervals.wildcard(new BytesRef("a*"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertEquals(Result.UNKNOWN, result); source = Intervals.or(Intervals.term("b"), Intervals.wildcard(new BytesRef("a*"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertEquals(Result.UNKNOWN, result); source = Intervals.ordered(Intervals.term("term1"), Intervals.prefix(new BytesRef("a"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, new Term("field", "term1")); source = Intervals.ordered(Intervals.prefix(new BytesRef("a"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertEquals(Result.UNKNOWN, result); source = Intervals.or(Intervals.term("b"), Intervals.prefix(new BytesRef("a"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertEquals(Result.UNKNOWN, result); source = Intervals.containedBy(Intervals.term("a"), Intervals.ordered(Intervals.term("b"), Intervals.term("c"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(3)); assertTermsEqual(result.extractions, new Term("field", "a"), new Term("field", "b"), new Term("field", "c")); source = Intervals.containing(Intervals.term("a"), Intervals.ordered(Intervals.term("b"), Intervals.term("c"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(3)); assertTermsEqual(result.extractions, new Term("field", "a"), new Term("field", "b"), new Term("field", "c")); source = Intervals.overlapping(Intervals.term("a"), Intervals.ordered(Intervals.term("b"), Intervals.term("c"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(3)); assertTermsEqual(result.extractions, new Term("field", "a"), new Term("field", "b"), new Term("field", "c")); source = Intervals.within(Intervals.term("a"), 2, Intervals.ordered(Intervals.term("b"), Intervals.term("c"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(3)); assertTermsEqual(result.extractions, new Term("field", "a"), new Term("field", "b"), new Term("field", "c")); source = Intervals.notContainedBy(Intervals.term("a"), Intervals.ordered(Intervals.term("b"), Intervals.term("c"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, new Term("field", "a")); source = Intervals.notContaining(Intervals.term("a"), Intervals.ordered(Intervals.term("b"), Intervals.term("c"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, new Term("field", "a")); source = Intervals.nonOverlapping(Intervals.term("a"), Intervals.ordered(Intervals.term("b"), Intervals.term("c"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); assertTermsEqual(result.extractions, new Term("field", "a")); source = Intervals.notWithin(Intervals.term("a"), 2, Intervals.ordered(Intervals.term("b"), Intervals.term("c"))); - result = analyze(new IntervalQuery("field", source), Version.CURRENT); + result = analyze(new IntervalQuery("field", source)); assertThat(result.verified, is(false)); assertThat(result.matchAllDocs, is(false)); assertThat(result.minimumShouldMatch, equalTo(1)); @@ -1219,7 +1218,7 @@ public void testRangeAndTermWithNestedMSM() { .setMinimumNumberShouldMatch(2) .build(); - Result r1 = analyze(q1, Version.CURRENT); + Result r1 = analyze(q1); assertEquals(2, r1.minimumShouldMatch); assertThat(r1.extractions, hasSize(3)); assertFalse(r1.matchAllDocs); @@ -1238,7 +1237,7 @@ public void testRangeAndTermWithNestedMSM() { .setMinimumNumberShouldMatch(2) .build(); - Result r = analyze(q, Version.CURRENT); + Result r = analyze(q); assertThat(r.minimumShouldMatch, equalTo(5)); assertThat(r.extractions, hasSize(7)); assertFalse(r.matchAllDocs); @@ -1254,7 +1253,7 @@ public void testCombinedRangeAndTermWithMinimumShouldMatch() { .setMinimumNumberShouldMatch(2) .build(); - Result r = analyze(disj, Version.CURRENT); + Result r = analyze(disj); assertThat(r.minimumShouldMatch, equalTo(1)); assertThat(r.extractions, hasSize(2)); assertFalse(r.matchAllDocs); @@ -1268,7 +1267,7 @@ public void testCombinedRangeAndTermWithMinimumShouldMatch() { .setMinimumNumberShouldMatch(2) .build(); - Result result = analyze(q, Version.CURRENT); + Result result = analyze(q); assertThat(result.minimumShouldMatch, equalTo(1)); assertThat(result.extractions.size(), equalTo(2)); assertFalse(result.verified); @@ -1279,7 +1278,7 @@ public void testCombinedRangeAndTermWithMinimumShouldMatch() { .add(q, Occur.MUST) .build(); - result = analyze(q, Version.CURRENT); + result = analyze(q); assertThat(result.minimumShouldMatch, equalTo(1)); assertThat(result.extractions.size(), equalTo(2)); assertFalse(result.verified); @@ -1293,7 +1292,7 @@ public void testCombinedRangeAndTermWithMinimumShouldMatch() { .setMinimumNumberShouldMatch(1) .build(); - result = analyze(q2, Version.CURRENT); + result = analyze(q2); assertThat(result.minimumShouldMatch, equalTo(2)); assertThat(result.extractions, hasSize(3)); assertFalse(result.verified); @@ -1307,7 +1306,7 @@ public void testCombinedRangeAndTermWithMinimumShouldMatch() { .add(new TermQuery(new Term("f", "v2")), Occur.MUST) .setMinimumNumberShouldMatch(1) .build(); - result = analyze(q3, Version.CURRENT); + result = analyze(q3); assertThat(result.minimumShouldMatch, equalTo(2)); assertThat(result.extractions, hasSize(4)); assertFalse(result.verified); @@ -1322,7 +1321,7 @@ public void testCombinedRangeAndTermWithMinimumShouldMatch() { .add(new TermQuery(new Term("f", "v2")), Occur.MUST) .setMinimumNumberShouldMatch(1) .build(); - result = analyze(q4, Version.CURRENT); + result = analyze(q4); assertThat(result.minimumShouldMatch, equalTo(2)); assertThat(result.extractions, hasSize(5)); assertFalse(result.verified); @@ -1337,7 +1336,7 @@ public void testCombinedRangeAndTermWithMinimumShouldMatch() { .add(IntPoint.newRangeQuery("i", 35, 40), Occur.MUST) .add(new TermQuery(new Term("f", "v2")), Occur.MUST) .build(); - result = analyze(q5, Version.CURRENT); + result = analyze(q5); assertThat(result.minimumShouldMatch, equalTo(2)); assertThat(result.extractions, hasSize(4)); assertFalse(result.verified); @@ -1352,7 +1351,7 @@ public void testCombinedRangeAndTermWithMinimumShouldMatch() { .add(IntPoint.newRangeQuery("i", 35, 40), Occur.MUST) .add(new TermQuery(new Term("f", "v2")), Occur.MUST) .build(); - result = analyze(q6, Version.CURRENT); + result = analyze(q6); assertThat(result.minimumShouldMatch, equalTo(3)); assertThat(result.extractions, hasSize(4)); assertFalse(result.verified); @@ -1369,7 +1368,7 @@ public void testCombinedRangeAndTermWithMinimumShouldMatch() { .add(new TermQuery(new Term("f", "2")), Occur.MUST) .build(), Occur.MUST) .build(); - result = analyze(q7, Version.CURRENT); + result = analyze(q7); assertThat(result.minimumShouldMatch, equalTo(3)); assertThat(result.extractions, hasSize(3)); assertFalse(result.verified);