Class Phrase
- java.lang.Object
-
- com.attivio.sdk.search.query.phrase.Phrase
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
AnchorFilter
,PhraseNear
,PhraseNot
,PhraseNotIn
,PhraseOr
,PhrasePlugin
,PhraseTerm
,ScopeBoost
,ScopeFilter
,ScopeTerm
public abstract class Phrase extends java.lang.Object implements java.io.Serializable, java.lang.Cloneable
Base class for a component to a phrase query.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Phrase.Parameter
Parameter Linked List.
-
Field Summary
Fields Modifier and Type Field Description protected int
boost
protected Phrase.Parameter
parameters
-
Constructor Summary
Constructors Constructor Description Phrase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Phrase
clone()
boolean
containsParameters()
Does this phrase operand contain any parameters in a non-default state.boolean
containsParameters(boolean compact)
Does this phrase operand contain any parameters in a non-default state.void
copyParameters(Phrase other)
Add all parameters fromother
.boolean
equals(java.lang.Object other)
int
getBoost()
Get the boost for this phrase.abstract int
getEndOffset()
Get the end offset (0 indexed, exclusive) for this term in the original query string.java.lang.Object
getParameter(java.lang.String name)
Get a parameter byname
.boolean
getParameter(java.lang.String name, boolean defaultValue)
Get a boolean parameter byname
, returningdefaultValue
if not found.int
getParameter(java.lang.String name, int defaultValue)
Get an int parameter byname
, returningdefaultValue
if not found.java.lang.String
getParameter(java.lang.String name, java.lang.String defaultValue)
Get a string parameter byname
, returningdefaultValue
if not found.protected java.lang.Object
getParameterInternal(java.lang.String name)
abstract int
getStartOffset()
Get the start offset (0 indexed, inclusive) for this term in the original query string.int
hashCode()
boolean
isMatchAll()
Returnstrue
if this phrase will match all documents.java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>>
parameters()
Get an iterator for returning all custom parameters.protected int
parseIntParameter(java.lang.Object value, int defaultValue)
java.lang.Object
removeParameter(java.lang.String name)
Remove custom parameter namedname
Phrase
rewrite(PhraseHandler handler)
Recursively rewrite this phrase usinghandler
.abstract Phrase
rewriteChildren(PhraseHandler handler)
Rewrite any children of this phrase usinghandler
.void
setBoost(int value)
Set the boost for this phrase.void
setParameter(java.lang.String name, java.lang.Object value)
Set parametername
tovalue
.void
setParameters(java.util.Map<java.lang.String,java.lang.Object> value)
Add all parameters fromvalue
.static Phrase[]
toArray(java.util.List<Phrase> terms)
Get an array of phrases fromterms
.java.lang.String
toString()
java.lang.String
toString(boolean compact)
Construct the string representation of this phrase.abstract void
toString(java.lang.StringBuilder buffer, boolean compact)
Appends the string representation of this query tobuffer
.
-
-
-
Field Detail
-
parameters
protected Phrase.Parameter parameters
-
boost
protected int boost
-
-
Method Detail
-
getStartOffset
public abstract 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
getStartOffset()
==getEndOffset()
, this indicates that the term did not come from a parsed query string.
-
getEndOffset
public abstract 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
getStartOffset()
==getEndOffset()
, this indicates that the term did not come from a parsed query string.
-
getBoost
public int getBoost()
Get the boost for this phrase.
-
setBoost
public void setBoost(int value)
Set the boost for this phrase.
-
isMatchAll
public boolean isMatchAll()
Returnstrue
if this phrase will match all documents.
-
containsParameters
public final boolean containsParameters()
Does this phrase operand contain any parameters in a non-default state.
-
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.
-
parameters
public java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> parameters()
Get an iterator for returning all custom parameters.
-
getParameter
public final java.lang.Object getParameter(java.lang.String name)
Get a parameter byname
.NOTE:
name
is case insensitive.
-
getParameterInternal
protected java.lang.Object getParameterInternal(java.lang.String name)
-
getParameter
public final java.lang.String getParameter(java.lang.String name, java.lang.String defaultValue)
Get a string parameter byname
, returningdefaultValue
if not found.NOTE:
name
is case insensitive.
-
getParameter
public final boolean getParameter(java.lang.String name, boolean defaultValue)
Get a boolean parameter byname
, returningdefaultValue
if not found.NOTE:
name
is case insensitive.
-
getParameter
public final int getParameter(java.lang.String name, int defaultValue)
Get an int parameter byname
, returningdefaultValue
if not found.NOTE:
name
is case insensitive.
-
setParameters
public final void setParameters(java.util.Map<java.lang.String,java.lang.Object> value)
Add all parameters fromvalue
.
-
copyParameters
public void copyParameters(Phrase other)
Add all parameters fromother
.
-
setParameter
public void setParameter(java.lang.String name, java.lang.Object value)
Set parametername
tovalue
.NOTE:
name
is case insensitive.
-
parseIntParameter
protected int parseIntParameter(java.lang.Object value, int defaultValue)
-
removeParameter
public java.lang.Object removeParameter(java.lang.String name)
Remove custom parameter namedname
NOTE: parameter names are case insensitive.
-
rewrite
public Phrase rewrite(PhraseHandler handler)
Recursively rewrite this phrase usinghandler
.NOTE: If a phrase has any children, the phrase itself will be passed to
handler
first, prior to its children. Ifhandler
returns a new phrase, its children will not be traversed automatically.
-
rewriteChildren
public abstract Phrase rewriteChildren(PhraseHandler handler)
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.
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public final java.lang.String toString(boolean compact)
Construct the string representation of this phrase.If
compact
is true, a more compact representation will be returned. This compact representation will omit common parameters that don't have any impact on search.
-
toString
public abstract void toString(java.lang.StringBuilder buffer, boolean compact)
Appends the string representation of this query tobuffer
.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
clone
public Phrase clone()
- Overrides:
clone
in classjava.lang.Object
-
-