Class SimpleQlt
- java.lang.Object
-
- com.tibco.patterns.learn.api.feature.AbstractQlt<T>
-
- com.tibco.patterns.learn.api.feature.TextQlt<com.tibco.patterns.learn.jaxb.model.SimpleQueryType>
-
- com.tibco.patterns.learn.api.feature.SimpleQlt
-
-
Constructor Summary
Constructors Constructor Description SimpleQlt(int[] fieldIndexes, double[] fieldWeights, java.util.List<java.lang.String> allFields)Creates simple querylet with given parameters.SimpleQlt(int[] fieldIndexes, java.util.List<java.lang.String> allFields)Default field weights 1.0 are used.SimpleQlt(int fieldIndex, java.util.List<java.lang.String> allFields)A single field with default field weight is used.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringasJavaCode(java.lang.String qltVarName, java.lang.String valuesVarName, java.lang.String fieldNamesVarName)Converts the querylet to a Java code string.java.util.List<java.lang.String>getFieldNames()doublegetFieldWeight(int fieldIndex)com.netrics.likeit.NetricsQuerygetNetricsQlt(java.lang.String[] values)Constructs a NetricsQuery querylet from the stored XML structure and the given field values.java.lang.StringgetThesaurusName()doublegetThesaurusWeight()booleanhasThesaurus()java.lang.BooleanisMatchEmpty()voidsetFields(int[] fieldIndexes, double[] fieldWeights)Replaces the list of fields in the querylet.voidsetFieldWeight(int fieldIndex, double weight)Sets the weight of the given field.voidsetMatchEmpty(boolean value)Sets the Match Empty parameter.-
Methods inherited from class com.tibco.patterns.learn.api.feature.TextQlt
serverThesName
-
Methods inherited from class com.tibco.patterns.learn.api.feature.AbstractQlt
getDftFieldWeight, getFieldIndex, getNFields, toString
-
-
-
-
Constructor Detail
-
SimpleQlt
public SimpleQlt(int[] fieldIndexes, double[] fieldWeights, java.util.List<java.lang.String> allFields)Creates simple querylet with given parameters.- Parameters:
fieldIndexes- must contain only indexes from the list of all fields (which was passed to 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.allFields- - all non-key fields in the data table.- 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, or if no fields are specified in allFields.
-
SimpleQlt
public SimpleQlt(int[] fieldIndexes, java.util.List<java.lang.String> allFields)Default field weights 1.0 are used.- See Also:
SimpleQlt(int[], double[], List)
-
SimpleQlt
public SimpleQlt(int fieldIndex, java.util.List<java.lang.String> allFields)A single field with default field weight is used.- Parameters:
fieldIndex- - index in the list of all fields (which was passed to constructor)- See Also:
SimpleQlt(int[], double[], List)
-
-
Method Detail
-
setFields
public void setFields(int[] fieldIndexes, double[] fieldWeights)Replaces the list of fields in the querylet.- Specified by:
setFieldsin classTextQlt<com.tibco.patterns.learn.jaxb.model.SimpleQueryType>- 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.
-
getNetricsQlt
public com.netrics.likeit.NetricsQuery getNetricsQlt(java.lang.String[] values)
Description copied from interface:QueryletConstructs a NetricsQuery querylet from the stored XML structure and the given field values. The NetricsQuery can then be used to obtain a feature score from the Patterns server. The querylet must use symmetric score type (if it is supported by the NetricsQuery type that it constructs).- Parameters:
values- - The values of all non-key fields in the record. The index of the field value to be used is determined by the field name that is read from the list of all fields stored in XML querylet structure.- Returns:
- the constructed NetricsQuery querylet.
- Throws:
java.lang.IllegalArgumentException- if incorrect number of table field values is provided.
-
getFieldNames
public java.util.List<java.lang.String> getFieldNames()
- Returns:
- a list with names of all fields used in the querylet.
-
asJavaCode
public java.lang.String asJavaCode(java.lang.String qltVarName, java.lang.String valuesVarName, java.lang.String fieldNamesVarName)Description copied from interface:QueryletConverts the querylet to a Java code string. Parameters are variable names in Java code. The new querylet must be assigned to qltVarName, then additional Java statements can be added to configure the querylet. The generated querylet must use symmetric score type (if it is supported by the NetricsQuery type that it constructs).- Parameters:
qltVarName- - the name of the variable to which the querylet is assigned.valuesVarName- - name of variable of type String[] that stores field values.fieldNamesVarName- - name of variable of type List<String> that stores all field names in the data table.- Returns:
- a string with Java code that creates the given querylet.
-
setFieldWeight
public void setFieldWeight(int fieldIndex, double weight)Description copied from class:TextQltSets the weight of the given field.- Specified by:
setFieldWeightin classTextQlt<com.tibco.patterns.learn.jaxb.model.SimpleQueryType>- Parameters:
fieldIndex- - index of the field in the list of fields assigned to this querylet.weight- - the new field weight.
-
getFieldWeight
public double getFieldWeight(int fieldIndex)
- Specified by:
getFieldWeightin classTextQlt<com.tibco.patterns.learn.jaxb.model.SimpleQueryType>- Parameters:
fieldIndex- - index of the field in the list of fields assigned to this querylet.- Returns:
- the weight of the given field.
-
setMatchEmpty
public void setMatchEmpty(boolean value)
Description copied from class:TextQltSets 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.- Specified by:
setMatchEmptyin classTextQlt<com.tibco.patterns.learn.jaxb.model.SimpleQueryType>- Parameters:
value- - the value of the Match Empty parameter.
-
isMatchEmpty
public java.lang.Boolean isMatchEmpty()
- Specified by:
isMatchEmptyin classTextQlt<com.tibco.patterns.learn.jaxb.model.SimpleQueryType>- Returns:
- the Match Empty parameter, or null if it was not set and the default is used.
- See Also:
TextQlt.setMatchEmpty(boolean)
-
hasThesaurus
public boolean hasThesaurus()
- Specified by:
hasThesaurusin classTextQlt<com.tibco.patterns.learn.jaxb.model.SimpleQueryType>- Returns:
- true if thesaurus has been assigned to this querylet.
-
getThesaurusName
public java.lang.String getThesaurusName()
- Specified by:
getThesaurusNamein classTextQlt<com.tibco.patterns.learn.jaxb.model.SimpleQueryType>- Returns:
- thesaurus name, or null if thesaurus is not assigned
-
getThesaurusWeight
public double getThesaurusWeight()
- Specified by:
getThesaurusWeightin classTextQlt<com.tibco.patterns.learn.jaxb.model.SimpleQueryType>- Returns:
- thesaurus weight, or default weight if thesaurus is not assigned. getThesaurusName() should be used first to check if the thesaurus is assigned.
-
-