public final class PhraseNear extends Phrase
Phrase.Parameter| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MINIMUM
Default minimum.
|
static int |
DEFAULT_NEAR_DISTANCE
Default distance for near/onear phrases.
|
static int |
MAX_DISTANCE
Maximum distance allowed.
|
static int |
MIN_DISTANCE
Minimum distance allowed.
|
static int |
REQUIRE_ALL_DISTANCE
Distance for require all phrases.
|
protected List<Phrase> |
terms
List of terms for matching.
|
parameters| Constructor and Description |
|---|
PhraseNear()
Constructor
|
PhraseNear(boolean ordered,
int distance)
Constructor
|
PhraseNear(List<Phrase> terms)
Constructor
|
PhraseNear(Phrase... terms)
Constructor
|
PhraseNear(Phrase[] terms,
int offset,
int length)
Constructor
|
PhraseNear(String... terms)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addTerm(Phrase term)
Add
term to this phrase. |
void |
addTerm(String term)
Add a
SearchTerm to this phrase. |
void |
addTerms(List<Phrase> terms)
Add
terms to this phrase. |
void |
addTerms(Phrase[] terms)
Add
terms to this phrase. |
void |
addTerms(Phrase[] terms,
int offset,
int length)
Add
|
PhraseNear |
append(Phrase... terms) |
PhraseNear |
append(Phrase term) |
PhraseNear |
append(String... terms) |
PhraseNear |
append(String term) |
PhraseNear |
clone() |
protected Phrase |
clone(Phrase[] terms,
int length)
Clone to facilitate rewrite().
|
boolean |
equals(Object other) |
int |
getDistance()
Get the maximum amount of distance allowed between the first and last matching term.
|
int |
getEndOffset()
Get the end offset (0 indexed, exclusive) for this term in the original query string.
|
int |
getMinimum()
Get the minimum number of sub phrases that are required to produce a match.
|
int |
getStartOffset()
Get the start offset (0 indexed, inclusive) for this term in the original query string.
|
List<Phrase> |
getTerms()
Get the terms for this phrase.
|
int |
hashCode() |
boolean |
isExactPhrase()
Returns true if this phrase requires all terms to be adjacent and in order.
|
boolean |
isOrdered()
Get if terms in phrase must be in order.
|
boolean |
isRequireAll()
Returns true if this phrase is a "require all" phrase.
|
static PhraseNear |
near()
Create a near (with default distance).
|
static PhraseNear |
near(Phrase... terms)
Create a near (with default distance).
|
static PhraseNear |
near(Phrase[] terms,
int offset,
int length)
Create a near (with default distance).
|
static PhraseNear |
near(Phrase a,
Phrase b,
int distance)
Create a near between 2 terms with specified distance.
|
static PhraseNear |
near(String... terms)
Create a near (with default distance).
|
static PhraseNear |
onear()
Create an onear (with default distance).
|
static PhraseNear |
onear(Phrase... terms)
Create an onear (with default distance).
|
static PhraseNear |
onear(Phrase[] terms,
int offset,
int length)
Create an onear (with default distance).
|
static PhraseNear |
onear(Phrase a,
Phrase b,
int distance)
Create an onear between 2 terms with specified distance.
|
static PhraseNear |
onear(String... terms)
Create an onear (with default distance).
|
static PhraseNear |
phrase()
Create an exact phrase.
|
static PhraseNear |
phrase(Phrase... terms)
Create an exact phrase.
|
static PhraseNear |
phrase(Phrase[] terms,
int offset,
int length)
Create an exact phrase.
|
static PhraseNear |
phrase(String... terms)
Create an exact phrase.
|
static PhraseNear |
requireAll()
Create a require all.
|
static PhraseNear |
requireAll(Phrase... terms)
Create a require all.
|
static PhraseNear |
requireAll(String... terms)
Create a require all.
|
Phrase |
rewrite(PhraseHandler handler)
Recursively rewrite this phrase using
handler. |
Phrase |
rewriteChildren(PhraseHandler handler)
Rewrite any children of this phrase using
handler. |
void |
setDistance(int value)
Set the maximum amount of distance allowed between the first and last matching term.
|
void |
setMinimum(int value)
Set the minimum number of sub phrases that are required to produce a match.
|
void |
setOrdered(boolean value)
Set if terms in phrase must be in order.
|
void |
setParameter(String name,
Object value)
Set parameter
name to value. |
void |
setTerms(List<Phrase> value)
Set the terms for this phrase.
|
void |
setTerms(Phrase... args)
Set the terms for this phrase.
|
void |
setTerms(String... args)
Set the terms for this phrase.
|
int |
size()
Get the number of terms in this phrase.
|
void |
toString(StringBuilder buffer,
boolean compact)
Appends the string representation of this query to
buffer. |
containsParameters, containsParameters, copyParameters, getBoost, getParameter, getParameter, getParameter, getParameter, getParameterInternal, isMatchAll, parameters, parseIntParameter, removeParameter, setBoost, setParameters, toArray, toString, toStringpublic static final int DEFAULT_MINIMUM
public static final int DEFAULT_NEAR_DISTANCE
public static final int REQUIRE_ALL_DISTANCE
Require all phrases place no restriction on distance between terms in phrase.
public static final int MAX_DISTANCE
Distances equal to are larger than this will be treated as a require all phrase.
public static final int MIN_DISTANCE
Distances equal to or less than this will be treated as a require all phrase.
public PhraseNear()
public PhraseNear(boolean ordered,
int distance)
public PhraseNear(String... terms)
public PhraseNear(Phrase... terms)
public PhraseNear(Phrase[] terms, int offset, int length)
public void setParameter(String name, Object value)
name to value.
NOTE: name is case insensitive.
setParameter in class Phrasepublic boolean isOrdered()
public void setOrdered(boolean value)
public int getDistance()
If this is 0, then all terms in this phrase must be adjacent to each other.
public void setDistance(int value)
public int getMinimum()
If this is 0, then all sub phrases are required for a match.
NOTE: minimum is not supported for ordered phrases.
public void setMinimum(int value)
If this is 0, then all sub phrases are required for a match.
NOTE: minimum is not supported for ordered phrases.
public boolean isExactPhrase()
public boolean isRequireAll()
Require all phrases place no restriction on ordering of terms or distance between terms.
public PhraseNear append(String term)
public PhraseNear append(String... terms)
public PhraseNear append(Phrase term)
public PhraseNear append(Phrase... terms)
public int hashCode()
public boolean equals(Object other)
public PhraseNear clone()
public void toString(StringBuilder buffer, boolean compact)
buffer.public static PhraseNear requireAll()
public static PhraseNear requireAll(Phrase... terms)
public static PhraseNear requireAll(String... terms)
public static PhraseNear phrase()
public static PhraseNear phrase(Phrase... terms)
public static PhraseNear phrase(Phrase[] terms, int offset, int length)
public static PhraseNear phrase(String... terms)
public static PhraseNear near()
public static PhraseNear near(Phrase... terms)
public static PhraseNear near(Phrase[] terms, int offset, int length)
public static PhraseNear near(Phrase a, Phrase b, int distance)
public static PhraseNear near(String... terms)
public static PhraseNear onear()
public static PhraseNear onear(Phrase... terms)
public static PhraseNear onear(Phrase[] terms, int offset, int length)
public static PhraseNear onear(Phrase a, Phrase b, int distance)
public static PhraseNear onear(String... terms)
public int getStartOffset()
PhraseThis 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.
getStartOffset in class Phrasepublic int getEndOffset()
PhraseThis 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.
getEndOffset in class Phrasepublic int size()
public void setTerms(String... args)
public void setTerms(Phrase... args)
public void addTerm(String term)
SearchTerm to this phrase.public void addTerm(Phrase term)
term to this phrase.public void addTerms(Phrase[] terms)
terms to this phrase.public void addTerms(Phrase[] terms, int offset, int length)
length terms from terms starting at offset.
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 Phrase rewriteChildren(PhraseHandler handler)
Phrasehandler.
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.
rewriteChildren in class PhraseCopyright © 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.