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.CloneableBase class for a component to a phrase query.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classPhrase.ParameterParameter Linked List.
-
Field Summary
Fields Modifier and Type Field Description protected intboostprotected Phrase.Parameterparameters
-
Constructor Summary
Constructors Constructor Description Phrase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Phraseclone()booleancontainsParameters()Does this phrase operand contain any parameters in a non-default state.booleancontainsParameters(boolean compact)Does this phrase operand contain any parameters in a non-default state.voidcopyParameters(Phrase other)Add all parameters fromother.booleanequals(java.lang.Object other)intgetBoost()Get the boost for this phrase.abstract intgetEndOffset()Get the end offset (0 indexed, exclusive) for this term in the original query string.java.lang.ObjectgetParameter(java.lang.String name)Get a parameter byname.booleangetParameter(java.lang.String name, boolean defaultValue)Get a boolean parameter byname, returningdefaultValueif not found.intgetParameter(java.lang.String name, int defaultValue)Get an int parameter byname, returningdefaultValueif not found.java.lang.StringgetParameter(java.lang.String name, java.lang.String defaultValue)Get a string parameter byname, returningdefaultValueif not found.protected java.lang.ObjectgetParameterInternal(java.lang.String name)abstract intgetStartOffset()Get the start offset (0 indexed, inclusive) for this term in the original query string.inthashCode()booleanisMatchAll()Returnstrueif 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 intparseIntParameter(java.lang.Object value, int defaultValue)java.lang.ObjectremoveParameter(java.lang.String name)Remove custom parameter namednamePhraserewrite(PhraseHandler handler)Recursively rewrite this phrase usinghandler.abstract PhraserewriteChildren(PhraseHandler handler)Rewrite any children of this phrase usinghandler.voidsetBoost(int value)Set the boost for this phrase.voidsetParameter(java.lang.String name, java.lang.Object value)Set parameternametovalue.voidsetParameters(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.StringtoString()java.lang.StringtoString(boolean compact)Construct the string representation of this phrase.abstract voidtoString(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()
Returnstrueif 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
compactistruethis 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:
nameis 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, returningdefaultValueif not found.NOTE:
nameis case insensitive.
-
getParameter
public final boolean getParameter(java.lang.String name, boolean defaultValue)Get a boolean parameter byname, returningdefaultValueif not found.NOTE:
nameis case insensitive.
-
getParameter
public final int getParameter(java.lang.String name, int defaultValue)Get an int parameter byname, returningdefaultValueif not found.NOTE:
nameis 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 parameternametovalue.NOTE:
nameis 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 namednameNOTE: 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
handlerfirst, prior to its children. Ifhandlerreturns 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
nullif all children were removed byhandler.This method may have no effect if this
Phraserepresents a leaf in the tree.NOTE: child phrases are not recursively traversed.
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public final java.lang.String toString(boolean compact)
Construct the string representation of this phrase.If
compactis 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:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
clone
public Phrase clone()
- Overrides:
clonein classjava.lang.Object
-
-