aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2020-09-30 20:53:44 +0200
committerGitHub <noreply@github.com>2020-09-30 20:53:44 +0200
commit2380e628089b24849b5d5b95189082b141815c68 (patch)
treef1281bed7c6faccf4e85366f264a47fceb8f3030 /config-model/src
parent849510dd107c770f4694a61f9af9c424b474fd23 (diff)
parentf54d8d82771457f7281f73bcc724180f9346c6f9 (diff)
Merge pull request #14648 from vespa-engine/bratseth/non-functional-changes
Non-functional changes only
Diffstat (limited to 'config-model/src')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java5
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java32
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/StructFieldOperation.java4
-rw-r--r--config-model/src/main/javacc/SDParser.jj8
-rw-r--r--config-model/src/test/examples/casing.sd1
-rw-r--r--config-model/src/test/examples/illegalidentifiers/alias.sd38
-rw-r--r--config-model/src/test/examples/illegalidentifiers/doctypename.sd49
-rw-r--r--config-model/src/test/examples/illegalidentifiers/fieldname.sd37
-rw-r--r--config-model/src/test/examples/illegalidentifiers/rankprofile.sd41
-rw-r--r--config-model/src/test/examples/illegalidentifiers/searchname.sd37
-rw-r--r--config-model/src/test/examples/illegalidentifiers/summaryclass.sd38
11 files changed, 21 insertions, 269 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java b/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java
index 2225997e685..852fdc17726 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/SearchBuilder.java
@@ -165,16 +165,15 @@ public class SearchBuilder {
}
private String importString(String str, String searchDefDir, DeployLogger deployLogger) throws ParseException {
- Search search;
SimpleCharStream stream = new SimpleCharStream(str);
try {
- search = new SDParser(stream, deployLogger, app, rankProfileRegistry, documentsOnly).search(docTypeMgr, searchDefDir);
+ return importRawSearch(new SDParser(stream, deployLogger, app, rankProfileRegistry, documentsOnly)
+ .search(docTypeMgr, searchDefDir));
} catch (TokenMgrException e) {
throw new ParseException("Unknown symbol: " + e.getMessage());
} catch (ParseException pe) {
throw new ParseException(stream.formatException(Exceptions.toMessageString(pe)));
}
- return importRawSearch(search);
}
/**
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java
index c3a0abc892c..ecc90e3d948 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java
@@ -58,7 +58,7 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
private RankType rankType = RankType.DEFAULT;
/** Rank settings in a "rank" block for the field. */
- private Ranking ranking = new Ranking();
+ private final Ranking ranking = new Ranking();
/**
* The literal boost of this field. This boost is added to a rank score
@@ -81,7 +81,7 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
private Matching matching = new Matching();
/** Attribute settings, or null if there are none */
- private Map<String, Attribute> attributes = new TreeMap<>();
+ private final Map<String, Attribute> attributes = new TreeMap<>();
/**
* The stemming setting of this field, or null to use the default.
@@ -93,27 +93,27 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
private NormalizeLevel normalizing = new NormalizeLevel();
/** Extra query commands of this field */
- private List<String> queryCommands = new java.util.ArrayList<>(0);
+ private final List<String> queryCommands = new java.util.ArrayList<>(0);
/** Summary fields defined in this field */
- private Map<String, SummaryField> summaryFields = new java.util.LinkedHashMap<>(0);
+ private final Map<String, SummaryField> summaryFields = new java.util.LinkedHashMap<>(0);
/** The explicitly index settings on this field */
- private Map<String, Index> indices = new java.util.LinkedHashMap<>();
+ private final Map<String, Index> indices = new java.util.LinkedHashMap<>();
private boolean idOverride = false;
/** Struct fields defined in this field */
- private Map<String,SDField> structFields = new java.util.LinkedHashMap<>(0);
+ private final Map<String,SDField> structFields = new java.util.LinkedHashMap<>(0);
/** The document that this field was declared in, or null*/
private SDDocumentType ownerDocType = null;
/** The aliases declared for this field. May pertain to indexes or attributes */
- private Map<String, String> aliasToName = new HashMap<>();
+ private final Map<String, String> aliasToName = new HashMap<>();
/** Pending operations that must be applied after parsing, due to use of not-yet-defined structs. */
- private List<FieldOperation> pendingOperations = new LinkedList<>();
+ private final List<FieldOperation> pendingOperations = new LinkedList<>();
private boolean isExtraField = false;
@@ -261,23 +261,18 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
public void populateWithStructFields(SDDocumentType sdoc, String name, DataType dataType, int recursion) {
DataType dt = getFirstStructOrMapRecursive();
- if (dt == null) {
- return;
- }
+ if (dt == null) return;
+
if (dataType instanceof MapDataType) {
MapDataType mdt = (MapDataType) dataType;
-
SDField keyField = new SDField(sdoc, name.concat(".key"), mdt.getKeyType(),
getOwnerDocType(), new Matching(), true, recursion + 1);
structFields.put("key", keyField);
-
SDField valueField = new SDField(sdoc, name.concat(".value"), mdt.getValueType(),
getOwnerDocType(), new Matching(), true, recursion + 1);
structFields.put("value", valueField);
} else {
- if (recursion >= 10) {
- return;
- }
+ if (recursion >= 10) return;
if (dataType instanceof CollectionDataType) {
dataType = ((CollectionDataType)dataType).getNestedType();
}
@@ -298,9 +293,8 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
public void populateWithStructMatching(SDDocumentType sdoc, String name, DataType dataType,
Matching superFieldMatching) {
DataType dt = getFirstStructOrMapRecursive();
- if (dt == null) {
- return;
- }
+ if (dt == null) return;
+
if (dataType instanceof MapDataType) {
MapDataType mdt = (MapDataType) dataType;
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/StructFieldOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/StructFieldOperation.java
index aa0949c1f32..7218ce25931 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/StructFieldOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/StructFieldOperation.java
@@ -13,8 +13,8 @@ import java.util.ListIterator;
*/
public class StructFieldOperation implements FieldOperation, FieldOperationContainer {
- private String structFieldName;
- private List<FieldOperation> pendingOperations = new LinkedList<>();
+ private final String structFieldName;
+ private final List<FieldOperation> pendingOperations = new LinkedList<>();
public StructFieldOperation(String structFieldName) {
this.structFieldName = structFieldName;
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj
index 3bbcf7979f3..869f671d8ef 100644
--- a/config-model/src/main/javacc/SDParser.jj
+++ b/config-model/src/main/javacc/SDParser.jj
@@ -2591,10 +2591,10 @@ String identifierWithDash() :
}
/**
- * This rule consumes an identifier. This must be kept in sync with all word tokens that should be parseable as
+ * Consumes an identifier. This must be kept in sync with all word tokens that should be parseable as
* identifiers.
*
- * @return The identifier string.
+ * @return the identifier string
*/
String identifier() : { }
{
@@ -2726,7 +2726,7 @@ String identifier() : { }
}
/**
- * This rule consumes a string token and returns the token image.
+ * Consumes a string token and returns the token image.
*
* @return The consumed token image.
*/
@@ -2736,7 +2736,7 @@ String string() : { }
}
/**
- * This rule consumes a quoted string token and returns the token image minus the quotes. This does not perform
+ * Consumes a quoted string token and returns the token image minus the quotes. This does not perform
* unescaping of the content, it simply removes the first and last character of the image. However, the token itself can
* contain anything but a double quote.
*
diff --git a/config-model/src/test/examples/casing.sd b/config-model/src/test/examples/casing.sd
index 7682545e229..670571ab9eb 100644
--- a/config-model/src/test/examples/casing.sd
+++ b/config-model/src/test/examples/casing.sd
@@ -4,7 +4,6 @@ search music {
field Color type string {
indexing: index
- # index-to: color
alias color: Colour
match {
exact
diff --git a/config-model/src/test/examples/illegalidentifiers/alias.sd b/config-model/src/test/examples/illegalidentifiers/alias.sd
deleted file mode 100644
index 5187706e93d..00000000000
--- a/config-model/src/test/examples/illegalidentifiers/alias.sd
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-search music {
-
- document music {
-
- field color type string {
- indexing: index
- match {
- exact
- }
- }
-
- field artist type string {
- indexing: attribute a | attribute b
- }
-
- field drummer type string {
- indexing: index
- alias: or
- }
-
- field guitarist type string {
- indexing: attribute
- match {
- token
- }
- }
-
- field title type string {
- indexing: index | attribute
- }
-
- field genre type string {
- # index-to: foo
- }
- }
-
-}
diff --git a/config-model/src/test/examples/illegalidentifiers/doctypename.sd b/config-model/src/test/examples/illegalidentifiers/doctypename.sd
deleted file mode 100644
index c460579576f..00000000000
--- a/config-model/src/test/examples/illegalidentifiers/doctypename.sd
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-search music {
-
- document and {
- field artist type string {
- indexing: attribute a | attribute b
- }
- }
-
- document music {
-
- field color type string {
- indexing: index
- match {
- exact
- }
- }
-
- field artist type string {
- indexing: attribute a | attribute b
- }
-
- field drummer type string {
- indexing: attribute
- }
-
- field guitarist type string {
- indexing: attribute
- match {
- token
- }
- }
-
- field title type string {
- indexing: index | attribute
- }
-
- field genre type string {
- # index-to: foo
- }
- }
-
- document true {
- field name type string {
- indexing: index | summary
- }
- }
-
-}
diff --git a/config-model/src/test/examples/illegalidentifiers/fieldname.sd b/config-model/src/test/examples/illegalidentifiers/fieldname.sd
deleted file mode 100644
index 45d2347ea9d..00000000000
--- a/config-model/src/test/examples/illegalidentifiers/fieldname.sd
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-search music {
-
- document music {
-
- field color type string {
- indexing: index
- match {
- exact
- }
- }
-
- field artist type string {
- indexing: attribute a | attribute b
- }
-
- field not type string {
- indexing: attribute
- }
-
- field guitarist type string {
- indexing: attribute
- match {
- token
- }
- }
-
- field title type string {
- indexing: index | attribute
- }
-
- field genre type string {
- # index-to: foo
- }
- }
-
-}
diff --git a/config-model/src/test/examples/illegalidentifiers/rankprofile.sd b/config-model/src/test/examples/illegalidentifiers/rankprofile.sd
deleted file mode 100644
index 27699ae6b90..00000000000
--- a/config-model/src/test/examples/illegalidentifiers/rankprofile.sd
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-search music {
-
- document music {
-
- field color type string {
- indexing: index
- match {
- exact
- }
- }
-
- field artist type string {
- indexing: attribute a | attribute b
- }
-
- field drummer type string {
- indexing: attribute
- }
-
- field guitarist type string {
- indexing: attribute
- match {
- token
- }
- }
-
- field title type string {
- indexing: index | attribute | summary
- }
-
- field genre type string {
- # index-to: foo
- }
- }
-
- rank-profile false inherits default {
- }
-
-
-}
diff --git a/config-model/src/test/examples/illegalidentifiers/searchname.sd b/config-model/src/test/examples/illegalidentifiers/searchname.sd
deleted file mode 100644
index d0bab60eb4e..00000000000
--- a/config-model/src/test/examples/illegalidentifiers/searchname.sd
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-search true {
-
- document music {
-
- field color type string {
- indexing: index
- match {
- exact
- }
- }
-
- field artist type string {
- indexing: attribute a | attribute b
- }
-
- field drummer type string {
- indexing: attribute
- }
-
- field guitarist type string {
- indexing: attribute
- match {
- token
- }
- }
-
- field title type string {
- indexing: index | attribute
- }
-
- field genre type string {
- # index-to: foo
- }
- }
-
-}
diff --git a/config-model/src/test/examples/illegalidentifiers/summaryclass.sd b/config-model/src/test/examples/illegalidentifiers/summaryclass.sd
deleted file mode 100644
index 99c7d592062..00000000000
--- a/config-model/src/test/examples/illegalidentifiers/summaryclass.sd
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-search music {
-
- document music {
-
- field color type string {
- indexing: index
- match {
- exact
- }
- }
-
- field artist type string {
- indexing: attribute a | attribute b
- }
-
- field drummer type string {
- indexing: attribute
- }
-
- field guitarist type string {
- indexing: attribute
- match {
- token
- }
- }
-
- field title type string {
- indexing: index | attribute | summary
- summary-to: id
- }
-
- field genre type string {
- # index-to: foo
- }
- }
-
-}