Class TextQlt<T extends com.tibco.patterns.learn.jaxb.model.SearchQueryBaseType>
- java.lang.Object
-
- com.tibco.patterns.learn.api.feature.AbstractQlt<T>
-
- com.tibco.patterns.learn.api.feature.TextQlt<T>
-
- All Implemented Interfaces:
Querylet
- Direct Known Subclasses:
CognateQlt,SimpleQlt
public abstract class TextQlt<T extends com.tibco.patterns.learn.jaxb.model.SearchQueryBaseType> extends AbstractQlt<T>
Provides common functionality for querylets that use approximate text matching (Simple and Cognate querylets). The functionality includes thesaurus handling, managing fields and field weights.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract doublegetFieldWeight(int fieldIndex)abstract java.lang.StringgetThesaurusName()abstract doublegetThesaurusWeight()abstract booleanhasThesaurus()abstract java.lang.BooleanisMatchEmpty()static java.lang.StringserverThesName(java.lang.String thesFileName, java.lang.String uuid)Returns the thesaurus name that is used on the server.abstract voidsetFields(int[] fieldIndexes, double[] fieldWeights)Replaces the list of fields in the querylet.abstract voidsetFieldWeight(int fieldIndex, double weight)Sets the weight of the given field.abstract voidsetMatchEmpty(boolean value)Sets the Match Empty parameter.-
Methods inherited from class com.tibco.patterns.learn.api.feature.AbstractQlt
getDftFieldWeight, getFieldIndex, getNFields, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tibco.patterns.learn.api.feature.Querylet
asJavaCode, getFieldNames, getNetricsQlt
-
-
-
-
Method Detail
-
hasThesaurus
public abstract boolean hasThesaurus()
- Returns:
- true if thesaurus has been assigned to this querylet.
-
getThesaurusName
public abstract java.lang.String getThesaurusName()
- Returns:
- thesaurus name, or null if thesaurus is not assigned
-
getThesaurusWeight
public abstract double getThesaurusWeight()
- Returns:
- thesaurus weight, or default weight if thesaurus is not assigned. getThesaurusName() should be used first to check if the thesaurus is assigned.
-
serverThesName
public static java.lang.String serverThesName(java.lang.String thesFileName, java.lang.String uuid)Returns the thesaurus name that is used on the server. This is the name name used to refer to the thesaurus loaded to server by Learn API (RecPairScorer). This is used to ensure uniqueness of thesaurus names on the server.- Parameters:
thesFileName- - name of thesaurus file.uuid- - unique identifier to be used for the server thesaurus name.- Returns:
- server thesaurus name created from thesFileName and prefix.
-
setFields
public abstract void setFields(int[] fieldIndexes, double[] fieldWeights)Replaces the list of fields in the querylet.- Parameters:
fieldIndexes- must contain only indexes from the list of all fields (which was passed to the constructor). A fieldIndex parameter in other methods refers to the number and order of the fields given here in fieldIndexes.fieldWeights- - the weights for each field in the querylet. May be null to set default weight 1.0.- Throws:
java.lang.IllegalArgumentException- if field indexes are not provided, or if an incorrect number of field weights is provided, or a weight value is invalid.
-
setFieldWeight
public abstract void setFieldWeight(int fieldIndex, double weight)Sets the weight of the given field.- Parameters:
fieldIndex- - index of the field in the list of fields assigned to this querylet.weight- - the new field weight.
-
getFieldWeight
public abstract double getFieldWeight(int fieldIndex)
- Parameters:
fieldIndex- - index of the field in the list of fields assigned to this querylet.- Returns:
- the weight of the given field.
-
setMatchEmpty
public abstract void setMatchEmpty(boolean value)
Sets the Match Empty parameter. If this is true, matching two empty strings results in an exact match score. If false (default), this results in an empty score.- Parameters:
value- - the value of the Match Empty parameter.
-
isMatchEmpty
public abstract java.lang.Boolean isMatchEmpty()
- Returns:
- the Match Empty parameter, or null if it was not set and the default is used.
- See Also:
setMatchEmpty(boolean)
-
-