DCausse has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/338084 )

Change subject: Add support for elastic 5.2.0
......................................................................

Add support for elastic 5.2.0

Change-Id: I96aaa0163a5030176e0146ccb1a7cf54c3465922
---
M pom.xml
M 
src/main/java/org/wikimedia/search/extra/fuzzylike/FuzzyLikeThisQueryBuilder.java
M 
src/main/java/org/wikimedia/search/extra/levenshtein/LevenshteinDistanceScoreBuilder.java
M src/main/java/org/wikimedia/search/extra/regex/SourceRegexQueryBuilder.java
M 
src/main/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryBuilder.java
5 files changed, 41 insertions(+), 41 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/search/extra 
refs/changes/84/338084/1

diff --git a/pom.xml b/pom.xml
index 578fd0d..35fe06b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
 
   <groupId>org.wikimedia.search</groupId>
   <artifactId>extra</artifactId>
-  <version>5.1.3-SNAPSHOT</version>
+  <version>5.2.0-SNAPSHOT</version>
   <description>Extra queries and filters for Elasticsearch.</description>
 
   <licenses>
@@ -44,8 +44,8 @@
 
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <elasticsearch.version>5.1.2</elasticsearch.version>
-    <lucene.version>6.3.0</lucene.version>
+    <elasticsearch.version>5.2.0</elasticsearch.version>
+    <lucene.version>6.4.0</lucene.version>
     <maven.compiler.target>1.8</maven.compiler.target>
     <maven.compiler.source>1.8</maven.compiler.source>
   </properties>
diff --git 
a/src/main/java/org/wikimedia/search/extra/fuzzylike/FuzzyLikeThisQueryBuilder.java
 
b/src/main/java/org/wikimedia/search/extra/fuzzylike/FuzzyLikeThisQueryBuilder.java
index eb4fd53..c2addbe 100644
--- 
a/src/main/java/org/wikimedia/search/extra/fuzzylike/FuzzyLikeThisQueryBuilder.java
+++ 
b/src/main/java/org/wikimedia/search/extra/fuzzylike/FuzzyLikeThisQueryBuilder.java
@@ -214,25 +214,25 @@
             if (token == XContentParser.Token.FIELD_NAME) {
                 currentFieldName = parser.currentName();
             } else if (token.isValue()) {
-                if 
(parseContext.getParseFieldMatcher().match(currentFieldName, LIKE_TEXT)) {
+                if (LIKE_TEXT.match(currentFieldName)) {
                     likeText = parser.text();
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, MAX_QUERY_TERMS)) {
+                } else if (MAX_QUERY_TERMS.match(currentFieldName)) {
                     maxNumTerms = parser.intValue();
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, IGNORE_TF)) {
+                } else if (IGNORE_TF.match(currentFieldName)) {
                     ignoreTF = parser.booleanValue();
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, FUZZINESS)) {
+                } else if (FUZZINESS.match(currentFieldName)) {
                     fuzziness = Fuzziness.parse(parser);
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, PREFIX_LENGTH)) {
+                } else if (PREFIX_LENGTH.match(currentFieldName)) {
                     prefixLength = parser.intValue();
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, ANALYZER)) {
+                } else if (ANALYZER.match(currentFieldName)) {
                     analyzer = parser.text();
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, 
FAIL_ON_UNSUPPORTED_FIELD)) {
+                } else if (FAIL_ON_UNSUPPORTED_FIELD.match(currentFieldName)) {
                     failOnUnsupportedField = parser.booleanValue();
                 } else {
                     throw new ParsingException(parser.getTokenLocation(), 
"[flt] query does not support [" + currentFieldName + "]");
                 }
             } else if (token == XContentParser.Token.START_ARRAY) {
-                if 
(parseContext.getParseFieldMatcher().match(currentFieldName, FIELDS)) {
+                if (FIELDS.match(currentFieldName)) {
                     fields = new ArrayList<>();
                     while (parser.nextToken() != 
XContentParser.Token.END_ARRAY) {
                         fields.add(parser.text());
diff --git 
a/src/main/java/org/wikimedia/search/extra/levenshtein/LevenshteinDistanceScoreBuilder.java
 
b/src/main/java/org/wikimedia/search/extra/levenshtein/LevenshteinDistanceScoreBuilder.java
index 8348fcc..e880a15 100644
--- 
a/src/main/java/org/wikimedia/search/extra/levenshtein/LevenshteinDistanceScoreBuilder.java
+++ 
b/src/main/java/org/wikimedia/search/extra/levenshtein/LevenshteinDistanceScoreBuilder.java
@@ -101,11 +101,11 @@
             if (token == XContentParser.Token.FIELD_NAME) {
                 currentFieldName = parser.currentName();
             } else if (token.isValue()) {
-                if 
(parseContext.getParseFieldMatcher().match(currentFieldName, FIELD)) {
+                if (FIELD.match(currentFieldName)) {
                     field = parser.text();
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, TEXT)) {
+                } else if (TEXT.match(currentFieldName)) {
                     text = parser.text();
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, MISSING)) {
+                } else if (MISSING.match(currentFieldName)) {
                     missing = parser.text();
                 } else {
                     throw new ParsingException(parser.getTokenLocation(), "{} 
query does not support {}", NAME,  currentFieldName);
diff --git 
a/src/main/java/org/wikimedia/search/extra/regex/SourceRegexQueryBuilder.java 
b/src/main/java/org/wikimedia/search/extra/regex/SourceRegexQueryBuilder.java
index 46f6ea5..c682f9d 100644
--- 
a/src/main/java/org/wikimedia/search/extra/regex/SourceRegexQueryBuilder.java
+++ 
b/src/main/java/org/wikimedia/search/extra/regex/SourceRegexQueryBuilder.java
@@ -371,17 +371,17 @@
             if (token == XContentParser.Token.FIELD_NAME) {
                 currentFieldName = parser.currentName();
             } else if (token.isValue()) {
-                if (context.getParseFieldMatcher().match(currentFieldName, 
FIELD)) {
+                if (FIELD.match(currentFieldName)) {
                     fieldPath = parser.text();
-                } else if 
(context.getParseFieldMatcher().match(currentFieldName, REGEX)) {
+                } else if (REGEX.match(currentFieldName)) {
                     regex = parser.text();
-                } else if 
(context.getParseFieldMatcher().match(currentFieldName, LOAD_FROM_SOURCE)) {
+                } else if (LOAD_FROM_SOURCE.match(currentFieldName)) {
                     loadFromSource = parser.booleanValue();
-                } else if 
(context.getParseFieldMatcher().match(currentFieldName, NGRAM_FIELD)) {
+                } else if (NGRAM_FIELD.match(currentFieldName)) {
                     ngramFieldPath = parser.text();
-                } else if 
(context.getParseFieldMatcher().match(currentFieldName, GRAM_SIZE)) {
+                } else if (GRAM_SIZE.match(currentFieldName)) {
                     ngramGramSize = parser.intValue();
-                } else if (!parseInto(settings, currentFieldName, parser, 
context)) {
+                } else if (!parseInto(settings, currentFieldName, parser)) {
                     throw new ParsingException(parser.getTokenLocation(), 
"[source-regex] filter does not support [" + currentFieldName
                             + "]");
                 }
@@ -402,26 +402,26 @@
         return Optional.of(builder);
     }
 
-    private static boolean parseInto(Settings settings, String fieldName, 
XContentParser parser, QueryParseContext context) throws IOException {
-        if (context.getParseFieldMatcher().match(fieldName, 
Settings.MAX_EXPAND)) {
+    private static boolean parseInto(Settings settings, String fieldName, 
XContentParser parser) throws IOException {
+        if (Settings.MAX_EXPAND.match(fieldName)) {
             settings.maxExpand = parser.intValue();
-        } else if (context.getParseFieldMatcher().match(fieldName, 
Settings.MAX_STATES_TRACED)) {
+        } else if (Settings.MAX_STATES_TRACED.match(fieldName)) {
             settings.maxStatesTraced = parser.intValue();
-        } else if (context.getParseFieldMatcher().match(fieldName, 
Settings.MAX_INSPECT)) {
+        } else if (Settings.MAX_INSPECT.match(fieldName)) {
             settings.maxInspect = parser.intValue() ;
-        } else if (context.getParseFieldMatcher().match(fieldName, 
Settings.MAX_DETERMINIZED_STATES)) {
+        } else if (Settings.MAX_DETERMINIZED_STATES.match(fieldName)) {
             settings.maxDeterminizedStates = parser.intValue();
-        } else if (context.getParseFieldMatcher().match(fieldName, 
Settings.MAX_NGRAMS_EXTRACTED)) {
+        } else if (Settings.MAX_NGRAMS_EXTRACTED.match(fieldName)) {
             settings.maxNgramsExtracted = parser.intValue();
-        } else if (context.getParseFieldMatcher().match(fieldName, 
Settings.CASE_SENSITIVE)) {
+        } else if (Settings.CASE_SENSITIVE.match(fieldName)) {
             settings.caseSensitive = parser.booleanValue();
-        } else if (context.getParseFieldMatcher().match(fieldName, 
Settings.LOCALE)) {
+        } else if (Settings.LOCALE.match(fieldName)) {
             settings.locale = LocaleUtils.parse(parser.text());
-        } else if (context.getParseFieldMatcher().match(fieldName, 
Settings.REJECT_UNACCELERATED)) {
+        } else if (Settings.REJECT_UNACCELERATED.match(fieldName)) {
             settings.rejectUnaccelerated = parser.booleanValue();
-        } else if (context.getParseFieldMatcher().match(fieldName, 
Settings.MAX_NGRAM_CLAUSES)) {
+        } else if (Settings.MAX_NGRAM_CLAUSES.match(fieldName)) {
             settings.maxNgramClauses = parser.intValue();
-        } else if (context.getParseFieldMatcher().match(fieldName, 
Settings.TIMEOUT)) {
+        } else if (Settings.TIMEOUT.match(fieldName)) {
             settings.timeout(parser.text());
         } else {
             return false;
diff --git 
a/src/main/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryBuilder.java
 
b/src/main/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryBuilder.java
index 7986f82..892938d 100644
--- 
a/src/main/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryBuilder.java
+++ 
b/src/main/java/org/wikimedia/search/extra/tokencount/TokenCountRouterQueryBuilder.java
@@ -132,24 +132,24 @@
             if (token == XContentParser.Token.FIELD_NAME) {
                 currentFieldName = parser.currentName();
             } else if (token.isValue()) {
-                if 
(parseContext.getParseFieldMatcher().match(currentFieldName, TEXT)) {
+                if (TEXT.match(currentFieldName)) {
                     text = parser.text();
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, FIELD)) {
+                } else if (FIELD.match(currentFieldName)) {
                     field = parser.text();
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, ANALYZER)) {
+                } else if (ANALYZER.match(currentFieldName)) {
                     analyzer = parser.text();
-                } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, 
DISCOUNT_OVERLAPS)) {
+                } else if (DISCOUNT_OVERLAPS.match(currentFieldName)) {
                     discountOverlaps = parser.booleanValue();
                 } else {
                     throw new ParsingException(parser.getTokenLocation(), 
"Unexpected field name " + currentFieldName);
                 }
-            } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, FALLBACK)) {
+            } else if (FALLBACK.match(currentFieldName)) {
                 if (token == XContentParser.Token.START_OBJECT) {
                     fallback = parseContext.parseInnerQueryBuilder();
                 } else {
                     throw new ParsingException(parser.getTokenLocation(), 
"fallback must be an object");
                 }
-            } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, CONDITIONS)) {
+            } else if (CONDITIONS.match(currentFieldName)) {
                 if (token != XContentParser.Token.START_ARRAY) {
                     throw new ParsingException(parser.getTokenLocation(), 
"Expected an array");
                 }
@@ -198,13 +198,13 @@
                 currentFieldName = parser.currentName();
             } else if (token.isValue()) {
                 ConditionDefinition condition;
-                if ((condition = ConditionDefinition.parse(parseContext, 
currentFieldName)) != null) {
+                if ((condition = ConditionDefinition.parse(currentFieldName)) 
!= null) {
                     currentCondition = condition;
                     checkValue = parser.intValue(true);
                 } else {
                     throw new ParsingException(parser.getTokenLocation(), 
"Unexpected field name " + currentFieldName);
                 }
-            } else if 
(parseContext.getParseFieldMatcher().match(currentFieldName, QUERY)) {
+            } else if (QUERY.match(currentFieldName)) {
                 if (token == XContentParser.Token.START_OBJECT) {
                     query = parseContext.parseInnerQueryBuilder();
                 } else {
@@ -333,9 +333,9 @@
             this.parseField = new ParseField(name());
         }
 
-        static ConditionDefinition parse(QueryParseContext context, String 
token) {
+        static ConditionDefinition parse(String token) {
             for (ConditionDefinition c : values()) {
-                if (context.getParseFieldMatcher().match(token, c.parseField)) 
{
+                if (c.parseField.match(token)) {
                     return c;
                 }
             }

-- 
To view, visit https://gerrit.wikimedia.org/r/338084
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96aaa0163a5030176e0146ccb1a7cf54c3465922
Gerrit-PatchSet: 1
Gerrit-Project: search/extra
Gerrit-Branch: master
Gerrit-Owner: DCausse <dcau...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to