public class TextCondition extends AbstractStringCondition
A condition based on a text pattern matching a document content
(default), or matching specific field(s).
When used on very large content, it is possible the pattern matching will
be done in chunks, sometimes not achieving expected results. Consider
creating your own condition from AbstractCharStreamCondition
if this is a concern.
<condition
class="com.norconex.importer.handler.condition.impl.TextCondition"
maxReadSize="(max characters to read at once)"
sourceCharset="(character encoding)">
<fieldMatcher
method="[basic|csv|wildcard|regex]"
ignoreCase="[false|true]"
ignoreDiacritic="[false|true]"
partial="[false|true]">
(Optional expression of field to match. Omit to use document content.)
</fieldMatcher>
<valueMatcher
method="[basic|csv|wildcard|regex]"
ignoreCase="[false|true]"
ignoreDiacritic="[false|true]"
partial="[false|true]">
(expression of value to match)
</valueMatcher>
</condition>
<condition
class="TextCondition">
<valueMatcher>apple</valueMatcher>
</condition>
Constructor and Description |
---|
TextCondition() |
TextCondition(TextMatcher valueMatcher) |
TextCondition(TextMatcher fieldMatcher,
TextMatcher valueMatcher) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
TextMatcher |
getFieldMatcher()
Gets the text matcher of field names.
|
TextMatcher |
getValueMatcher()
Gets the text matcher for content or field values.
|
int |
hashCode() |
protected void |
loadStringConditionFromXML(XML xml)
Loads configuration settings specific to the implementing class.
|
protected void |
saveStringConditionToXML(XML xml)
Saves configuration settings specific to the implementing class.
|
void |
setFieldMatcher(TextMatcher fieldMatcher)
Sets the text matcher of field names.
|
void |
setValueMatcher(TextMatcher valueMatcher)
Sets the text matcher for content or field values.
|
protected boolean |
testDocument(HandlerDoc doc,
String input,
ParseState parseState,
int sectionIndex) |
String |
toString() |
getMaxReadSize, loadCharStreamConditionFromXML, saveCharStreamConditionToXML, setMaxReadSize, testDocument
getSourceCharset, loadFromXML, saveToXML, setSourceCharset, testDocument
public TextCondition()
public TextCondition(TextMatcher valueMatcher)
public TextCondition(TextMatcher fieldMatcher, TextMatcher valueMatcher)
public TextMatcher getValueMatcher()
public void setValueMatcher(TextMatcher valueMatcher)
valueMatcher
- text matcherpublic TextMatcher getFieldMatcher()
public void setFieldMatcher(TextMatcher fieldMatcher)
fieldMatcher
- text matcherprotected boolean testDocument(HandlerDoc doc, String input, ParseState parseState, int sectionIndex) throws ImporterHandlerException
testDocument
in class AbstractStringCondition
ImporterHandlerException
protected void loadStringConditionFromXML(XML xml)
AbstractStringCondition
loadStringConditionFromXML
in class AbstractStringCondition
xml
- XML configurationprotected void saveStringConditionToXML(XML xml)
AbstractStringCondition
saveStringConditionToXML
in class AbstractStringCondition
xml
- the XMLpublic boolean equals(Object other)
equals
in class AbstractStringCondition
public int hashCode()
hashCode
in class AbstractStringCondition
public String toString()
toString
in class AbstractStringCondition
Copyright © 2009–2023 Norconex Inc.. All rights reserved.