public class SimilarityConstraint extends Constraint
This type of constraint might not be supported by all the yard implementations. If it is not supported it is just ignored.
With version 0.12.0 support for Text and Reference
contexts where added. The getContextType() can be used to determine the
type of the parsed context and the #getStringContext(),
#getTextContext() and #getReferenceContext() methods can be
used to get the typed context versions. The getContext()
Constraint.ConstraintType| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
additionalFields |
protected String |
context |
protected DataTypeEnum |
contextType |
| Constructor and Description |
|---|
SimilarityConstraint(Collection<String> context,
Collection<String> languages) |
SimilarityConstraint(Collection<String> context,
Collection<String> languages,
List<String> additionalFields) |
SimilarityConstraint(Collection<String> context,
DataTypeEnum contextType) |
SimilarityConstraint(Collection<String> context,
DataTypeEnum contextType,
List<String> additionalFields) |
SimilarityConstraint(String context)
Deprecated.
use one of the constructor explicitly parsing the
DataTypeEnum or the languages (assuming DataTypeEnum.Text |
SimilarityConstraint(String context,
List<String> additionalFields)
Deprecated.
use one of the constructor explicitly parsing the
DataTypeEnum or the languages (assuming DataTypeEnum.Text |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
getAdditionalFields()
Additional fields used for similarity calculations
|
String |
getContext()
Getter for the context
|
DataTypeEnum |
getContextType()
The type of the Context.
|
Collection<String> |
getLanguages()
The languages for the Context, or
null if none are defined |
getBoost, getType, setBoost, toStringprotected final String context
protected final DataTypeEnum contextType
public SimilarityConstraint(String context)
DataTypeEnum or the languages (assuming DataTypeEnum.TextDataTypeEnum.Text with unknown language.context - the contextpublic SimilarityConstraint(String context, List<String> additionalFields)
DataTypeEnum or the languages (assuming DataTypeEnum.TextDataTypeEnum.Text with unknown language.context - the contextadditionalFields - additional fields to include in the similarity searchpublic SimilarityConstraint(Collection<String> context, Collection<String> languages)
public SimilarityConstraint(Collection<String> context, DataTypeEnum contextType)
public SimilarityConstraint(Collection<String> context, Collection<String> languages, List<String> additionalFields)
public SimilarityConstraint(Collection<String> context, DataTypeEnum contextType, List<String> additionalFields)
public List<String> getAdditionalFields()
public Collection<String> getLanguages()
null if none are definednull if none. NOTE that the
returned collection may contain the null value
as it represents the default languagepublic String getContext()
public DataTypeEnum getContextType()
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.