public class ProximitySearch extends DocFilter
Constructor and Description |
---|
ProximitySearch(java.lang.String term1,
java.lang.String term2)
Create a proximity search filter.
|
ProximitySearch(java.lang.String term1,
java.lang.String term2,
int distance)
Create a proximity search filter.
|
ProximitySearch(java.lang.String term1,
java.lang.String term2,
int distance,
boolean isOrdered)
Create a proximity search filter
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(DataRecord rec)
Return whether the DataRecord is accepted by this filter.
|
int |
getDistance()
Get the distance for this ProximitySearch
|
java.lang.String |
getTerm1()
Get the first term for this ProximitySearch
|
java.lang.String |
getTerm2()
Get the second term for this ProximitySearch
|
boolean |
isOrdered()
Return whether this ProximitySearch is ordered.
|
protected boolean |
matchDoc(DocData doc)
Return whether the represented document is accepted by this filter.
|
boolean |
matchText(java.lang.String text)
Match this filter against the body of text
|
void |
setTerm1(java.lang.String term)
Set the first term for this ProximitySearch
|
void |
setTerm2(java.lang.String term)
Set the second term for this ProximitySearch
|
java.lang.String |
toString()
Return a string representation of this search.
|
accept, filterDocuments, getTag, setTag
filterRecords
public ProximitySearch(java.lang.String term1, java.lang.String term2)
term1
- the first word to search forterm2
- the second word to search forpublic ProximitySearch(java.lang.String term1, java.lang.String term2, int distance)
term1
- the first word to search forterm2
- the second word to search fordistance
- the number of words which can be between term1 and term2public ProximitySearch(java.lang.String term1, java.lang.String term2, int distance, boolean isOrdered)
term1
- the first word to search forterm2
- the second word to search fordistance
- the number of words which can be between term1 and term2isOrdered
- whether the order of term1 and term2 is important. If
this flag is true, the filter only matches when term1
precedes term2 within the allowed distance.public boolean accept(DataRecord rec)
accept
in class DataFilter
rec
- the data record to match.public int getDistance()
public java.lang.String getTerm1()
public java.lang.String getTerm2()
public boolean isOrdered()
protected boolean matchDoc(DocData doc)
public boolean matchText(java.lang.String text)
text
- the text to check againstpublic void setTerm1(java.lang.String term)
term
- the first termpublic void setTerm2(java.lang.String term)
term
- the second termpublic java.lang.String toString()
toString
in class java.lang.Object