aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2022-03-03 12:30:37 +0000
committerArne H Juul <arnej@yahooinc.com>2022-03-03 14:05:19 +0000
commit4624468f898d89bb8925f5b55304dab54e93fb01 (patch)
treef5a11b73f2b922a7443fe79f95fef393207c11f1 /config-model/src/main/java/com
parentfd48b501a984290f28b35d8be1ee5a0512b25814 (diff)
unify enums
Diffstat (limited to 'config-model/src/main/java/com')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexInfo.java17
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/VsmFields.java5
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/MatchAlgorithm.java (renamed from config-model/src/main/java/com/yahoo/searchdefinition/parser/MatchAlgorithm.java)7
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/MatchType.java (renamed from config-model/src/main/java/com/yahoo/searchdefinition/parser/MatchType.java)5
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/Matching.java47
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java4
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/MatchOperation.java10
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/parser/MatchCase.java10
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedMatchSettings.java10
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/AttributesImplicitWord.java3
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/ExactMatch.java7
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchConsistency.java12
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/NGramMatch.java3
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/TagType.java3
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/TextMatch.java3
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/WordMatch.java3
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java3
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/StreamingValidator.java3
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeMessageBuilder.java5
19 files changed, 77 insertions, 83 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexInfo.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexInfo.java
index 495c3da5d3a..b65af3a8f02 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexInfo.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexInfo.java
@@ -17,6 +17,7 @@ import com.yahoo.searchdefinition.document.FieldSet;
import com.yahoo.searchdefinition.document.GeoPos;
import com.yahoo.searchdefinition.document.ImmutableSDField;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.searchdefinition.document.Stemming;
import com.yahoo.searchdefinition.processing.ExactMatch;
import com.yahoo.searchdefinition.processing.NGramMatch;
@@ -153,7 +154,7 @@ public class IndexInfo extends Derived implements IndexInfoConfig.Producer {
if (normalizeAccents(field)) {
addIndexCommand(field, CMD_NORMALIZE);
}
- if (field.getMatching() == null || field.getMatching().getType().equals(Matching.Type.TEXT)) {
+ if (field.getMatching() == null || field.getMatching().getType().equals(MatchType.TEXT)) {
addIndexCommand(field, CMD_PLAIN_TOKENS);
}
}
@@ -383,7 +384,7 @@ public class IndexInfo extends Derived implements IndexInfoConfig.Producer {
.indexname(fieldSet.getName())
.command(CMD_INDEX));
if ( ! isExactMatch(fieldSetMatching)) {
- if (fieldSetMatching == null || fieldSetMatching.getType().equals(Matching.Type.TEXT)) {
+ if (fieldSetMatching == null || fieldSetMatching.getType().equals(MatchType.TEXT)) {
iiB.command(
new IndexInfoConfig.Indexinfo.Command.Builder()
.indexname(fieldSet.getName())
@@ -420,24 +421,24 @@ public class IndexInfo extends Derived implements IndexInfoConfig.Producer {
}
if (fieldSetMatching != null) {
// Explicit matching set on fieldset
- if (fieldSetMatching.getType().equals(Matching.Type.EXACT)) {
+ if (fieldSetMatching.getType().equals(MatchType.EXACT)) {
String term = fieldSetMatching.getExactMatchTerminator();
if (term==null) term=ExactMatch.DEFAULT_EXACT_TERMINATOR;
iiB.command(
new IndexInfoConfig.Indexinfo.Command.Builder()
.indexname(fieldSet.getName())
.command("exact "+term));
- } else if (fieldSetMatching.getType().equals(Matching.Type.WORD)) {
+ } else if (fieldSetMatching.getType().equals(MatchType.WORD)) {
iiB.command(
new IndexInfoConfig.Indexinfo.Command.Builder()
.indexname(fieldSet.getName())
.command(CMD_WORD));
- } else if (fieldSetMatching.getType().equals(Matching.Type.GRAM)) {
+ } else if (fieldSetMatching.getType().equals(MatchType.GRAM)) {
iiB.command(
new IndexInfoConfig.Indexinfo.Command.Builder()
.indexname(fieldSet.getName())
.command("ngram "+(fieldSetMatching.getGramSize()>0 ? fieldSetMatching.getGramSize() : NGramMatch.DEFAULT_GRAM_SIZE)));
- } else if (fieldSetMatching.getType().equals(Matching.Type.TEXT)) {
+ } else if (fieldSetMatching.getType().equals(MatchType.TEXT)) {
}
}
@@ -477,8 +478,8 @@ public class IndexInfo extends Derived implements IndexInfoConfig.Producer {
private boolean isExactMatch(Matching m) {
if (m == null) return false;
- if (m.getType().equals(Matching.Type.EXACT)) return true;
- if (m.getType().equals(Matching.Type.WORD)) return true;
+ if (m.getType().equals(MatchType.EXACT)) return true;
+ if (m.getType().equals(MatchType.WORD)) return true;
return false;
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/VsmFields.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/VsmFields.java
index 7310a3fbd88..3edc93fc7c7 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/VsmFields.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/VsmFields.java
@@ -16,6 +16,7 @@ import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.FieldSet;
import com.yahoo.searchdefinition.document.GeoPos;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.searchdefinition.document.SDDocumentType;
import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.vespa.config.search.vsm.VsmfieldsConfig;
@@ -226,9 +227,9 @@ public class VsmFields extends Derived implements VsmfieldsConfig.Producer {
public VsmfieldsConfig.Fieldspec.Builder getFieldSpecConfig() {
VsmfieldsConfig.Fieldspec.Builder fB = new VsmfieldsConfig.Fieldspec.Builder();
String matchingName = matching.getType().getName();
- if (matching.getType().equals(Matching.Type.TEXT))
+ if (matching.getType().equals(MatchType.TEXT))
matchingName = "";
- if (matching.getType() != Matching.Type.EXACT) {
+ if (matching.getType() != MatchType.EXACT) {
if (matching.isPrefix()) {
matchingName = "prefix";
} else if (matching.isSubstring()) {
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/MatchAlgorithm.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/MatchAlgorithm.java
index 92dc75a9eda..545f2e293dc 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/MatchAlgorithm.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/MatchAlgorithm.java
@@ -1,11 +1,16 @@
-package com.yahoo.searchdefinition.parser;
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.searchdefinition.document;
+
+/** Which match algorithm is used by this matching setup */
public enum MatchAlgorithm {
NORMAL("normal"),
PREFIX("prefix"),
SUBSTRING("substring"),
SUFFIX("suffix");
+
private String name;
MatchAlgorithm(String name) { this.name = name; }
+
public String getName() { return name; }
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/MatchType.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/MatchType.java
index cd24db6d72e..dd4af0965d8 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/MatchType.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/MatchType.java
@@ -1,11 +1,14 @@
-package com.yahoo.searchdefinition.parser;
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.searchdefinition.document;
public enum MatchType {
TEXT("text"),
WORD("word"),
EXACT("exact"),
GRAM("gram");
+
private String name;
MatchType(String name) { this.name = name; }
+
public String getName() { return name; }
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/Matching.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/Matching.java
index d506b22297d..59fee1b57bc 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/Matching.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/Matching.java
@@ -11,34 +11,13 @@ import java.io.Serializable;
*/
public class Matching implements Cloneable, Serializable {
- public static final Type defaultType = Type.TEXT;
-
- public enum Type {
- TEXT("text"),
- WORD("word"),
- EXACT("exact"),
- GRAM("gram");
- private String name;
- Type(String name) { this.name = name; }
- public String getName() { return name; }
- }
-
- /** Which match algorithm is used by this matching setup */
- public enum Algorithm {
- NORMAL("normal"),
- PREFIX("prefix"),
- SUBSTRING("substring"),
- SUFFIX("suffix");
- private String name;
- Algorithm(String name) { this.name = name; }
- public String getName() { return name; }
- }
+ public static final MatchType defaultType = MatchType.TEXT;
- private Type type = Type.TEXT;
+ private MatchType type = MatchType.TEXT;
private Case casing = Case.UNCASED;
/** The basic match algorithm */
- private Algorithm algorithm = Algorithm.NORMAL;
+ private MatchAlgorithm algorithm = MatchAlgorithm.NORMAL;
private boolean typeUserSet = false;
@@ -55,14 +34,14 @@ public class Matching implements Cloneable, Serializable {
/** Creates a matching of type "text" */
public Matching() {}
- public Matching(Type type) {
+ public Matching(MatchType type) {
this.type = type;
}
- public Type getType() { return type; }
+ public MatchType getType() { return type; }
public Case getCase() { return casing; }
- public void setType(Type type) {
+ public void setType(MatchType type) {
this.type = type;
typeUserSet = true;
}
@@ -73,20 +52,20 @@ public class Matching implements Cloneable, Serializable {
public Matching maxLength(int maxLength) { this.maxLength = maxLength; return this; }
public boolean isTypeUserSet() { return typeUserSet; }
- public Algorithm getAlgorithm() { return algorithm; }
+ public MatchAlgorithm getAlgorithm() { return algorithm; }
- public void setAlgorithm(Algorithm algorithm) {
+ public void setAlgorithm(MatchAlgorithm algorithm) {
this.algorithm = algorithm;
algorithmUserSet = true;
}
public boolean isAlgorithmUserSet() { return algorithmUserSet; }
- public boolean isPrefix() { return algorithm == Algorithm.PREFIX; }
+ public boolean isPrefix() { return algorithm == MatchAlgorithm.PREFIX; }
- public boolean isSubstring() { return algorithm == Algorithm.SUBSTRING; }
+ public boolean isSubstring() { return algorithm == MatchAlgorithm.SUBSTRING; }
- public boolean isSuffix() { return algorithm == Algorithm.SUFFIX; }
+ public boolean isSuffix() { return algorithm == MatchAlgorithm.SUFFIX; }
/** Returns the gram size, or -1 if not set. Should only be set with gram matching. */
public int getGramSize() { return gramSize; }
@@ -102,7 +81,7 @@ public class Matching implements Cloneable, Serializable {
}
if (m.isTypeUserSet()) {
this.setType(m.getType());
- if (m.getType() == Type.GRAM)
+ if (m.getType() == MatchType.GRAM)
gramSize = m.gramSize;
}
if (m.getExactMatchTerminator() != null) {
@@ -127,7 +106,7 @@ public class Matching implements Cloneable, Serializable {
@Override
public String toString() {
- return type + " matching [" + (type==Type.GRAM ? "gram size " + gramSize : "supports " + algorithm) +
+ return type + " matching [" + (type==MatchType.GRAM ? "gram size " + gramSize : "supports " + algorithm) +
"], [exact-terminator "+exactMatchTerminator+"]";
}
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 d9bf8ed83ff..d9bdf5dc917 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
@@ -536,7 +536,7 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
*/
// TODO: When this is not the same as getMatching().setthis we have a potential for inconsistency. Find the right
// Matching object for struct fields at lookup time instead.
- public void setMatchingType(Matching.Type type) {
+ public void setMatchingType(MatchType type) {
this.getMatching().setType(type);
for (SDField structField : getStructFields()) {
structField.setMatchingType(type);
@@ -559,7 +559,7 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer,
*/
// TODO: When this is not the same as getMatching().setthis we have a potential for inconsistency. Find the right
// Matching object for struct fields at lookup time instead.
- public void setMatchingAlgorithm(Matching.Algorithm algorithm) {
+ public void setMatchingAlgorithm(MatchAlgorithm algorithm) {
this.getMatching().setAlgorithm(algorithm);
for (SDField structField : getStructFields()) {
structField.getMatching().setAlgorithm(algorithm);
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/MatchOperation.java b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/MatchOperation.java
index d6e3a898420..322f26bc0e3 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/MatchOperation.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/fieldoperation/MatchOperation.java
@@ -2,7 +2,9 @@
package com.yahoo.searchdefinition.fieldoperation;
import com.yahoo.searchdefinition.document.Case;
+import com.yahoo.searchdefinition.document.MatchAlgorithm;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.searchdefinition.document.SDField;
/**
@@ -10,14 +12,14 @@ import com.yahoo.searchdefinition.document.SDField;
*/
public class MatchOperation implements FieldOperation {
- private Matching.Type matchingType;
+ private MatchType matchingType;
private Case casing;
private Integer gramSize;
private Integer maxLength;
- private Matching.Algorithm matchingAlgorithm;
+ private MatchAlgorithm matchingAlgorithm;
private String exactMatchTerminator;
- public void setMatchingType(Matching.Type matchingType) {
+ public void setMatchingType(MatchType matchingType) {
this.matchingType = matchingType;
}
@@ -28,7 +30,7 @@ public class MatchOperation implements FieldOperation {
this.maxLength = maxLength;
}
- public void setMatchingAlgorithm(Matching.Algorithm matchingAlgorithm) {
+ public void setMatchingAlgorithm(MatchAlgorithm matchingAlgorithm) {
this.matchingAlgorithm = matchingAlgorithm;
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/MatchCase.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/MatchCase.java
deleted file mode 100644
index 30e968873ec..00000000000
--- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/MatchCase.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.yahoo.searchdefinition.parser;
-
-public enum MatchCase {
- CASED("cased"),
- UNCASED("uncased");
- private String name;
- MatchCase(String name) { this.name = name; }
- public String getName() { return name;}
-}
-
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedMatchSettings.java b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedMatchSettings.java
index 03b27d8c9ef..9b51521ad2b 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedMatchSettings.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/parser/ParsedMatchSettings.java
@@ -1,5 +1,9 @@
package com.yahoo.searchdefinition.parser;
+import com.yahoo.searchdefinition.document.Case;
+import com.yahoo.searchdefinition.document.MatchType;
+import com.yahoo.searchdefinition.document.MatchAlgorithm;
+
import java.util.Optional;
/**
@@ -11,14 +15,14 @@ import java.util.Optional;
public class ParsedMatchSettings {
private MatchType matchType = null;
- private MatchCase matchCase = null;
+ private Case matchCase = null;
private MatchAlgorithm matchAlgorithm = null;
private String exactTerminator = null;
private Integer gramSize = null;
private Integer maxLength = null;
Optional<MatchType> getMatchType() { return Optional.ofNullable(matchType); }
- Optional<MatchCase> getMatchCase() { return Optional.ofNullable(matchCase); }
+ Optional<Case> getMatchCase() { return Optional.ofNullable(matchCase); }
Optional<MatchAlgorithm> getMatchAlgorithm() { return Optional.ofNullable(matchAlgorithm); }
Optional<String> getExactTerminator() { return Optional.ofNullable(exactTerminator); }
Optional<Integer> getGramSize() { return Optional.ofNullable(gramSize); }
@@ -26,7 +30,7 @@ public class ParsedMatchSettings {
// TODO - consider allowing each set only once:
void setType(MatchType value) { this.matchType = value; }
- void setCase(MatchCase value) { this.matchCase = value; }
+ void setCase(Case value) { this.matchCase = value; }
void setAlgorithm(MatchAlgorithm value) { this.matchAlgorithm = value; }
void setExactTerminator(String value) { this.exactTerminator = value; }
void setGramSize(int value) { this.gramSize = value; }
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AttributesImplicitWord.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AttributesImplicitWord.java
index d3fa3282f4f..3c10ccb92dc 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AttributesImplicitWord.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AttributesImplicitWord.java
@@ -7,6 +7,7 @@ import com.yahoo.document.DataType;
import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.ImmutableSDField;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.document.NumericDataType;
import com.yahoo.vespa.model.container.search.QueryProfiles;
@@ -38,7 +39,7 @@ public class AttributesImplicitWord extends Processor {
private void processField(ImmutableSDField field) {
if (fieldImplicitlyWordMatch(field)) {
- field.getMatching().setType(Matching.Type.WORD);
+ field.getMatching().setType(MatchType.WORD);
}
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ExactMatch.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ExactMatch.java
index a516667c524..ca473a2029f 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/ExactMatch.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/ExactMatch.java
@@ -7,6 +7,7 @@ import com.yahoo.document.DataType;
import com.yahoo.searchdefinition.RankProfileRegistry;
import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.searchdefinition.document.Stemming;
import com.yahoo.vespa.indexinglanguage.ExpressionSearcher;
@@ -39,8 +40,8 @@ public class ExactMatch extends Processor {
}
private void processField(SDField field, Schema schema) {
- Matching.Type matching = field.getMatching().getType();
- if (matching.equals(Matching.Type.EXACT) || matching.equals(Matching.Type.WORD)) {
+ MatchType matching = field.getMatching().getType();
+ if (matching.equals(MatchType.EXACT) || matching.equals(MatchType.WORD)) {
implementExactMatch(field, schema);
} else if (field.getMatching().getExactMatchTerminator() != null) {
warn(schema, field, "exact-terminator requires 'exact' matching to have any effect.");
@@ -54,7 +55,7 @@ public class ExactMatch extends Processor {
field.setStemming(Stemming.NONE);
field.getNormalizing().inferLowercase();
- if (field.getMatching().getType().equals(Matching.Type.WORD)) {
+ if (field.getMatching().getType().equals(MatchType.WORD)) {
field.addQueryCommand("word");
} else { // exact
String exactTerminator = DEFAULT_EXACT_TERMINATOR;
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchConsistency.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchConsistency.java
index c302ef63cfd..6cb0a86b481 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchConsistency.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/MatchConsistency.java
@@ -5,7 +5,7 @@ import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.searchdefinition.RankProfileRegistry;
import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.Matching;
-import com.yahoo.searchdefinition.document.Matching.Type;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.vespa.indexinglanguage.ExpressionVisitor;
import com.yahoo.vespa.indexinglanguage.expressions.Expression;
@@ -33,14 +33,14 @@ public class MatchConsistency extends Processor {
public void process(boolean validate, boolean documentsOnly) {
if ( ! validate) return;
- Map<String, Matching.Type> types = new HashMap<>();
+ Map<String, MatchType> types = new HashMap<>();
for (SDField field : schema.allConcreteFields()) {
new MyVisitor(schema, field, types).visit(field.getIndexingScript());
}
}
- private void checkMatching(Schema schema, SDField field, Map<String, Type> types, String indexTo) {
- Type prevType = types.get(indexTo);
+ private void checkMatching(Schema schema, SDField field, Map<String, MatchType> types, String indexTo) {
+ MatchType prevType = types.get(indexTo);
if (prevType == null) {
types.put(indexTo, field.getMatching().getType());
} else if ( ! field.getMatching().getType().equals(prevType)) {
@@ -54,9 +54,9 @@ public class MatchConsistency extends Processor {
final Schema schema;
final SDField field;
- final Map<String, Type> types;
+ final Map<String, MatchType> types;
- MyVisitor(Schema schema, SDField field, Map<String, Type> types) {
+ MyVisitor(Schema schema, SDField field, Map<String, MatchType> types) {
this.schema = schema;
this.field = field;
this.types = types;
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/NGramMatch.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/NGramMatch.java
index b5f573ecf71..2ba149925e9 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/NGramMatch.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/NGramMatch.java
@@ -7,6 +7,7 @@ import com.yahoo.document.DataType;
import com.yahoo.searchdefinition.RankProfileRegistry;
import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.searchdefinition.document.Stemming;
import com.yahoo.vespa.indexinglanguage.expressions.*;
@@ -29,7 +30,7 @@ public class NGramMatch extends Processor {
@Override
public void process(boolean validate, boolean documentsOnly) {
for (SDField field : schema.allConcreteFields()) {
- if (field.getMatching().getType().equals(Matching.Type.GRAM))
+ if (field.getMatching().getType().equals(MatchType.GRAM))
implementGramMatch(schema, field, validate);
else if (validate && field.getMatching().getGramSize() >= 0)
throw new IllegalArgumentException("gram-size can only be set when the matching mode is 'gram'");
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/TagType.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/TagType.java
index 8cebfc89458..357575660ea 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/TagType.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/TagType.java
@@ -6,6 +6,7 @@ import com.yahoo.searchdefinition.RankProfileRegistry;
import com.yahoo.document.*;
import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.searchdefinition.document.RankType;
import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.vespa.model.container.search.QueryProfiles;
@@ -38,7 +39,7 @@ public class TagType extends Processor {
if (!field.doesIndexing() && !field.doesAttributing()) return;
Matching m = field.getMatching();
if ( ! m.isTypeUserSet())
- m.setType(Matching.Type.WORD);
+ m.setType(MatchType.WORD);
if (field.getRankType() == null || field.getRankType() == RankType.DEFAULT)
field.setRankType((RankType.TAGS));
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/TextMatch.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/TextMatch.java
index a8065ec4bb5..c2b41edf454 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/TextMatch.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/TextMatch.java
@@ -7,6 +7,7 @@ import com.yahoo.document.CollectionDataType;
import com.yahoo.document.DataType;
import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.searchdefinition.document.Stemming;
import com.yahoo.vespa.indexinglanguage.ExpressionConverter;
@@ -36,7 +37,7 @@ public class TextMatch extends Processor {
@Override
public void process(boolean validate, boolean documentsOnly) {
for (SDField field : schema.allConcreteFields()) {
- if (field.getMatching().getType() != Matching.Type.TEXT) continue;
+ if (field.getMatching().getType() != MatchType.TEXT) continue;
ScriptExpression script = field.getIndexingScript();
if (script == null) continue;
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/WordMatch.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/WordMatch.java
index c4989604457..2a1afd616bc 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/WordMatch.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/WordMatch.java
@@ -4,6 +4,7 @@ package com.yahoo.searchdefinition.processing;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.searchdefinition.RankProfileRegistry;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.searchdefinition.document.SDField;
import com.yahoo.searchdefinition.document.Stemming;
import com.yahoo.searchdefinition.Schema;
@@ -39,7 +40,7 @@ public class WordMatch extends Processor {
}
private void processField(SDField field) {
- if (!field.getMatching().getType().equals(Matching.Type.WORD)) {
+ if (!field.getMatching().getType().equals(MatchType.WORD)) {
return;
}
field.setStemming(Stemming.NONE);
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java
index 67667674ea9..2b474cb3b1b 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/NoPrefixForIndexes.java
@@ -5,6 +5,7 @@ import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.ImmutableSDField;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchAlgorithm;
import com.yahoo.searchdefinition.Index;
import com.yahoo.searchdefinition.derived.DerivedConfiguration;
import com.yahoo.vespa.model.VespaModel;
@@ -32,7 +33,7 @@ public class NoPrefixForIndexes extends Validator {
for (ImmutableSDField field : schema.allConcreteFields()) {
if (field.doesIndexing()) {
//if (!field.getIndexTo().isEmpty() && !field.getIndexTo().contains(field.getName())) continue;
- if (field.getMatching().getAlgorithm().equals(Matching.Algorithm.PREFIX)) {
+ if (field.getMatching().getAlgorithm().equals(MatchAlgorithm.PREFIX)) {
failField(schema, field);
}
for (Map.Entry<String, Index> e : field.getIndices().entrySet()) {
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/StreamingValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/StreamingValidator.java
index f27efe07941..dc5ffa7ecc7 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/StreamingValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/StreamingValidator.java
@@ -9,6 +9,7 @@ import com.yahoo.document.ReferenceDataType;
import com.yahoo.searchdefinition.document.Attribute;
import com.yahoo.searchdefinition.document.ImmutableSDField;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.search.AbstractSearchCluster;
import com.yahoo.vespa.model.search.SearchCluster;
@@ -39,7 +40,7 @@ public class StreamingValidator extends Validator {
private static void warnStreamingGramMatching(SearchCluster sc, DeployLogger logger) {
if (sc.getSdConfig() != null) {
for (ImmutableSDField sd : sc.getSdConfig().getSearch().allConcreteFields()) {
- if (sd.getMatching().getType().equals(Matching.Type.GRAM)) {
+ if (sd.getMatching().getType().equals(MatchType.GRAM)) {
logger.logApplicationPackage(Level.WARNING, "For streaming search cluster '" + sc.getClusterName() +
"', SD field '" + sd.getName() + "': n-gram matching is not supported for streaming search.");
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeMessageBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeMessageBuilder.java
index 5e258fde821..b461b38c75f 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeMessageBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeMessageBuilder.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.model.application.validation.change.search;
import com.yahoo.searchdefinition.Schema;
import com.yahoo.searchdefinition.document.ImmutableSDField;
import com.yahoo.searchdefinition.document.Matching;
+import com.yahoo.searchdefinition.document.MatchType;
import com.yahoo.searchdefinition.document.NormalizeLevel;
import com.yahoo.searchdefinition.document.Stemming;
import com.yahoo.vespa.documentmodel.SummaryField;
@@ -85,9 +86,9 @@ public class IndexingScriptChangeMessageBuilder {
}
private static String toString(Matching matching) {
- Matching.Type type = matching.getType();
+ MatchType type = matching.getType();
String retval = type.getName();
- if (type == Matching.Type.GRAM) {
+ if (type == MatchType.GRAM) {
retval += " (size " + matching.getGramSize() + ")";
}
return retval;