diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-05-19 12:03:06 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-05-19 12:03:06 +0200 |
commit | 5c24dc5c9642a8d9ed70aee4c950fd0678a1ebec (patch) | |
tree | bd9b74bf00c832456f0b83c1b2cd7010be387d68 /config-model/src/main/java/com/yahoo/schema/fieldoperation/MatchOperation.java | |
parent | f17c4fe7de4c55f5c4ee61897eab8c2f588d8405 (diff) |
Rename the 'searchdefinition' package to 'schema'
Diffstat (limited to 'config-model/src/main/java/com/yahoo/schema/fieldoperation/MatchOperation.java')
-rw-r--r-- | config-model/src/main/java/com/yahoo/schema/fieldoperation/MatchOperation.java | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/fieldoperation/MatchOperation.java b/config-model/src/main/java/com/yahoo/schema/fieldoperation/MatchOperation.java new file mode 100644 index 00000000000..a568b5b0f66 --- /dev/null +++ b/config-model/src/main/java/com/yahoo/schema/fieldoperation/MatchOperation.java @@ -0,0 +1,65 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.schema.fieldoperation; + +import com.yahoo.schema.document.Case; +import com.yahoo.schema.document.MatchAlgorithm; +import com.yahoo.schema.document.MatchType; +import com.yahoo.schema.document.SDField; + +/** + * @author Einar M R Rosenvinge + */ +public class MatchOperation implements FieldOperation { + + private MatchType matchingType; + private Case casing; + private Integer gramSize; + private Integer maxLength; + private MatchAlgorithm matchingAlgorithm; + private String exactMatchTerminator; + + public void setMatchingType(MatchType matchingType) { + this.matchingType = matchingType; + } + + public void setGramSize(Integer gramSize) { + this.gramSize = gramSize; + } + public void setMaxLength(Integer maxLength) { + this.maxLength = maxLength; + } + + public void setMatchingAlgorithm(MatchAlgorithm matchingAlgorithm) { + this.matchingAlgorithm = matchingAlgorithm; + } + + public void setExactMatchTerminator(String exactMatchTerminator) { + this.exactMatchTerminator = exactMatchTerminator; + } + + public void setCase(Case casing) { + this.casing = casing; + } + + public void apply(SDField field) { + if (matchingType != null) { + field.setMatchingType(matchingType); + } + if (casing != null) { + field.setMatchingCase(casing); + } + if (gramSize != null) { + field.getMatching().setGramSize(gramSize); + } + if (maxLength != null) { + field.getMatching().maxLength(maxLength); + } + if (matchingAlgorithm != null) { + field.setMatchingAlgorithm(matchingAlgorithm); + } + if (exactMatchTerminator != null) { + field.getMatching().setExactMatchTerminator(exactMatchTerminator); + } + } + +} |