public class ReferenceFilter extends Object implements IOnMatchFilter, IReferenceFilter, IDocumentFilter, IMetadataFilter, IXMLConfigurable
Filters URL based on a regular expression.
<filter
class="com.norconex.collector.core.filter.impl.ReferenceFilter"
onMatch="[include|exclude]">
<valueMatcher
method="[basic|csv|wildcard|regex]"
ignoreCase="[false|true]"
ignoreDiacritic="[false|true]"
partial="[false|true]">
(Expression matching the document reference.)
</valueMatcher>
</filter>
<filter
class="ReferenceFilter"
onMatch="exclude">
<valueMatcher
method="regex">
.*/login/.*
</valueMatcher>
</filter>
The above will reject documents having "/login/" in their reference.
Pattern
Constructor and Description |
---|
ReferenceFilter() |
ReferenceFilter(TextMatcher valueMatcher) |
ReferenceFilter(TextMatcher valueMatcher,
OnMatch onMatch) |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptDocument(Doc document)
Whether to accept a document.
|
boolean |
acceptMetadata(String reference,
Properties metadata)
Whether to accept the metadata.
|
boolean |
acceptReference(String reference)
Whether to accept this reference.
|
boolean |
equals(Object other) |
OnMatch |
getOnMatch() |
TextMatcher |
getValueMatcher()
Gets the value matcher.
|
int |
hashCode() |
void |
loadFromXML(XML xml) |
void |
saveToXML(XML xml) |
void |
setOnMatch(OnMatch onMatch) |
void |
setValueMatcher(TextMatcher valueMatcher)
Sets the value matcher.
|
String |
toString() |
public ReferenceFilter()
public ReferenceFilter(TextMatcher valueMatcher)
public ReferenceFilter(TextMatcher valueMatcher, OnMatch onMatch)
public TextMatcher getValueMatcher()
public void setValueMatcher(TextMatcher valueMatcher)
valueMatcher
- value matcherpublic OnMatch getOnMatch()
getOnMatch
in interface IOnMatchFilter
public void setOnMatch(OnMatch onMatch)
public boolean acceptReference(String reference)
IReferenceFilter
acceptReference
in interface IReferenceFilter
reference
- the reference to accept/rejecttrue
if accepted, false
otherwisepublic void loadFromXML(XML xml)
loadFromXML
in interface IXMLConfigurable
public void saveToXML(XML xml)
saveToXML
in interface IXMLConfigurable
public boolean acceptDocument(Doc document)
IDocumentFilter
acceptDocument
in interface IDocumentFilter
document
- the document to accept/rejecttrue
if accepted, false
otherwisepublic boolean acceptMetadata(String reference, Properties metadata)
IMetadataFilter
acceptMetadata
in interface IMetadataFilter
reference
- the reference associated with the metadatametadata
- metadata associated with the referencetrue
if accepted, false
otherwiseCopyright © 2014–2023 Norconex Inc.. All rights reserved.