Class PhraseTerm
- java.lang.Object
-
- com.attivio.sdk.search.query.phrase.Phrase
-
- com.attivio.sdk.search.query.phrase.PhraseTerm
-
- All Implemented Interfaces:
TokenAnnotationSet
,java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
FuzzyTerm
,RegexTerm
,SearchTerm
,TermRange
,WildcardTerm
public abstract class PhraseTerm extends Phrase implements TokenAnnotationSet
Represents an atomic term in a phrase.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.attivio.sdk.search.query.phrase.Phrase
Phrase.Parameter
-
-
Field Summary
Fields Modifier and Type Field Description protected long
annotations
Arbitrary token annotations.protected int
endOffset
protected int
startOffset
-
Fields inherited from class com.attivio.sdk.search.query.phrase.Phrase
boost, parameters
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PhraseTerm()
Constructor.protected
PhraseTerm(PhraseTerm base)
Constructor.protected
PhraseTerm(TokenAnnotation annotation)
Constructor.protected
PhraseTerm(TokenAnnotation... annotation)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsAnnotation(TokenAnnotation value)
Returns true if the specified annotation is set.boolean
containsParameters(boolean compact)
Does this phrase operand contain any parameters in a non-default state.boolean
equals(java.lang.Object other)
long
getAnnotations()
Get all set token annotations as a bit mask.int
getEndOffset()
Get the end offset (0 indexed, exclusive) for this term in the original query string.int
getStartOffset()
Get the start offset (0 indexed, inclusive) for this term in the original query string.int
hashCode()
int
offsetGap(PhraseTerm previous)
Get the offset gap betweenprevious
and this term.Phrase
rewriteChildren(PhraseHandler handler)
Rewrite any children of this phrase usinghandler
.void
setAnnotation(TokenAnnotation value)
Set a TokenAnnotation.void
setAnnotations(long value)
Set the token annotations from a bit mask.void
setEndOffset(int value)
Set the end offset (0 indexed, exclusive) for this term in the original query string.void
setParameter(java.lang.String name, java.lang.Object value)
Set parametername
tovalue
.void
setStartOffset(int value)
Set the start offset (0 indexed, inclusive) for this term in the original query string.void
unsetAnnotation(TokenAnnotation value)
Unset a TokenAnnotation.-
Methods inherited from class com.attivio.sdk.search.query.phrase.Phrase
clone, containsParameters, copyParameters, getBoost, getParameter, getParameter, getParameter, getParameter, getParameterInternal, isMatchAll, parameters, parseIntParameter, removeParameter, rewrite, setBoost, setParameters, toArray, toString, toString, toString
-
-
-
-
Constructor Detail
-
PhraseTerm
protected PhraseTerm()
Constructor.
-
PhraseTerm
protected PhraseTerm(TokenAnnotation annotation)
Constructor.
-
PhraseTerm
protected PhraseTerm(TokenAnnotation... annotation)
Constructor.
-
PhraseTerm
protected PhraseTerm(PhraseTerm base)
Constructor.
-
-
Method Detail
-
setParameter
public void setParameter(java.lang.String name, java.lang.Object value)
Description copied from class:Phrase
Set parametername
tovalue
.NOTE:
name
is case insensitive.- Overrides:
setParameter
in classPhrase
-
getStartOffset
public int getStartOffset()
Get the start offset (0 indexed, inclusive) for this term in the original query string.This value is set during parsing and indicates the start offset into the original query string that this term represents. In general, offsets should not be set/modified by query transformers and it is recommended that start and end offsets are set to zero when cloning.
NOTE: if
Phrase.getStartOffset()
==Phrase.getEndOffset()
, this indicates that the term did not come from a parsed query string.- Specified by:
getStartOffset
in classPhrase
-
setStartOffset
public void setStartOffset(int value)
Set the start offset (0 indexed, inclusive) for this term in the original query string.
-
getEndOffset
public int getEndOffset()
Get the end offset (0 indexed, exclusive) for this term in the original query string.This value is set during parsing and indicates the end offset of the original query string that this term represents. In general, offsets should not be set/modified by query transformers and it is recommended that start and end offsets are set to zero when cloning.
NOTE: if
Phrase.getStartOffset()
==Phrase.getEndOffset()
, this indicates that the term did not come from a parsed query string.- Specified by:
getEndOffset
in classPhrase
-
setEndOffset
public void setEndOffset(int value)
Set the end offset (0 indexed, exclusive) for this term in the original query string.
-
getAnnotations
public long getAnnotations()
Get all set token annotations as a bit mask.- Specified by:
getAnnotations
in interfaceTokenAnnotationSet
-
setAnnotations
public void setAnnotations(long value)
Set the token annotations from a bit mask.- Specified by:
setAnnotations
in interfaceTokenAnnotationSet
-
setAnnotation
public void setAnnotation(TokenAnnotation value)
Set a TokenAnnotation.- Specified by:
setAnnotation
in interfaceTokenAnnotationSet
-
containsAnnotation
public boolean containsAnnotation(TokenAnnotation value)
Returns true if the specified annotation is set.- Specified by:
containsAnnotation
in interfaceTokenAnnotationSet
-
unsetAnnotation
public void unsetAnnotation(TokenAnnotation value)
Unset a TokenAnnotation.- Specified by:
unsetAnnotation
in interfaceTokenAnnotationSet
-
offsetGap
public int offsetGap(PhraseTerm previous)
Get the offset gap betweenprevious
and this term.NOTE: if this term or the
previous
term do not contain offsets,1
is returned.NOTE: Returns
0
ifprevious
isnull
.
-
containsParameters
public boolean containsParameters(boolean compact)
Does this phrase operand contain any parameters in a non-default state.If
compact
istrue
this will only return true if at least one parameter in the compact representation of this phrase exists.- Overrides:
containsParameters
in classPhrase
-
rewriteChildren
public Phrase rewriteChildren(PhraseHandler handler)
Description copied from class:Phrase
Rewrite any children of this phrase usinghandler
.Returns the modified phrase, which may be
null
if all children were removed byhandler
.This method may have no effect if this
Phrase
represents a leaf in the tree.NOTE: child phrases are not recursively traversed.
- Specified by:
rewriteChildren
in classPhrase
-
-