public abstract class Phrase extends Object implements Serializable, Cloneable
Modifier and Type | Class and Description |
---|---|
protected static class |
Phrase.Parameter
Parameter Linked List.
|
Modifier and Type | Field and Description |
---|---|
protected Phrase.Parameter |
parameters |
Constructor and Description |
---|
Phrase() |
Modifier and Type | Method and 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 from
other . |
boolean |
equals(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.
|
Object |
getParameter(String name)
Get a parameter by
name . |
boolean |
getParameter(String name,
boolean defaultValue)
Get a boolean parameter by
name , returning defaultValue if not found. |
int |
getParameter(String name,
int defaultValue)
Get an int parameter by
name , returning defaultValue if not found. |
String |
getParameter(String name,
String defaultValue)
Get a string parameter by
name , returning defaultValue if not found. |
protected Object |
getParameterInternal(String name) |
abstract int |
getStartOffset()
Get the start offset (0 indexed, inclusive) for this term in the original query string.
|
int |
hashCode() |
boolean |
isMatchAll()
Returns
true if this phrase will match all documents. |
Iterator<Map.Entry<String,Object>> |
parameters()
Get an iterator for returning all custom parameters.
|
protected int |
parseIntParameter(Object value,
int defaultValue) |
Object |
removeParameter(String name)
Remove custom parameter named
name |
Phrase |
rewrite(PhraseHandler handler)
Recursively rewrite this phrase using
handler . |
abstract Phrase |
rewriteChildren(PhraseHandler handler)
Rewrite any children of this phrase using
handler . |
void |
setBoost(int value)
Set the boost for this phrase.
|
void |
setParameter(String name,
Object value)
Set parameter
name to value . |
void |
setParameters(Map<String,Object> value)
Add all parameters from
value . |
static Phrase[] |
toArray(List<Phrase> terms)
Get an array of phrases from
terms . |
String |
toString() |
String |
toString(boolean compact)
Construct the string representation of this phrase.
|
abstract void |
toString(StringBuilder buffer,
boolean compact)
Appends the string representation of this query to
buffer . |
protected Phrase.Parameter parameters
public abstract int getStartOffset()
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.
public abstract int getEndOffset()
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.
public int getBoost()
public void setBoost(int value)
public boolean isMatchAll()
true
if this phrase will match all documents.public final boolean containsParameters()
public boolean containsParameters(boolean compact)
If compact
is true
this will only return true if at least one parameter
in the compact representation of this phrase exists.
public Iterator<Map.Entry<String,Object>> parameters()
public final Object getParameter(String name)
name
.
NOTE: name
is case insensitive.
public final String getParameter(String name, String defaultValue)
name
, returning defaultValue
if not found.
NOTE: name
is case insensitive.
public final boolean getParameter(String name, boolean defaultValue)
name
, returning defaultValue
if not found.
NOTE: name
is case insensitive.
public final int getParameter(String name, int defaultValue)
name
, returning defaultValue
if not found.
NOTE: name
is case insensitive.
public final void setParameters(Map<String,Object> value)
value
.public void copyParameters(Phrase other)
other
.public void setParameter(String name, Object value)
name
to value
.
NOTE: name
is case insensitive.
protected int parseIntParameter(Object value, int defaultValue)
public Object removeParameter(String name)
name
NOTE: parameter names are case insensitive.
public Phrase rewrite(PhraseHandler handler)
handler
.
NOTE: If a phrase has any children, the phrase itself will be passed to handler
first, prior to its children.
If handler
returns a new phrase, its children will not be traversed automatically.
public abstract Phrase rewriteChildren(PhraseHandler handler)
handler
.
Returns the modified phrase, which may be null
if all children were removed by handler
.
This method may have no effect if this Phrase
represents a leaf in the tree.
NOTE: child phrases are not recursively traversed.
public final String toString(boolean compact)
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.
public abstract void toString(StringBuilder buffer, boolean compact)
buffer
.Copyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.