blob: d6e3a89842061f4503309b35cf995764974715f8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition.fieldoperation;
import com.yahoo.searchdefinition.document.Case;
import com.yahoo.searchdefinition.document.Matching;
import com.yahoo.searchdefinition.document.SDField;
/**
* @author Einar M R Rosenvinge
*/
public class MatchOperation implements FieldOperation {
private Matching.Type matchingType;
private Case casing;
private Integer gramSize;
private Integer maxLength;
private Matching.Algorithm matchingAlgorithm;
private String exactMatchTerminator;
public void setMatchingType(Matching.Type matchingType) {
this.matchingType = matchingType;
}
public void setGramSize(Integer gramSize) {
this.gramSize = gramSize;
}
public void setMaxLength(Integer maxLength) {
this.maxLength = maxLength;
}
public void setMatchingAlgorithm(Matching.Algorithm 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);
}
}
}
|