Skip to content

Commit

Permalink
Fix RegexTagger not picking up XML-configured "fieldMatcher".
Browse files Browse the repository at this point in the history
  • Loading branch information
essiembre committed Mar 3, 2023
1 parent 0d09886 commit 2fbdc6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions CHANGES.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
</properties>
<body>

<release version="3.0.1-SNAPSHOT" date="2022-??-??">

<release version="3.0.1-SNAPSHOT" date="2023-??-??">
<action dev="essiembre" type="add" issue="76">
New DOMPreserveTransformer.
</action>
<action dev="essiembre" type="update">
Maven dependency updates: norconex-commons-maven-parent 1.0.2-SNAPSHOT.
</action>

<action dev="essiembre" type="fix">
Fix RegexTagger not picking up XML-configured "fieldMatcher".
</action>
</release>


<release version="3.0.0" date="2022-01-02"
description="Major release. NOT a drop-in replacement for 2.x.">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public void setFieldMatcher(TextMatcher fieldMatcher) {

@Override
protected void loadStringTaggerFromXML(XML xml) {
fieldMatcher.loadFromXML(xml.getXML("fieldMatcher"));
List<XML> nodes = xml.getXMLList("pattern");
for (XML node : nodes) {
node.checkDeprecated("@caseSensitive", "ignoreCase", true);
Expand All @@ -209,6 +210,7 @@ protected void loadStringTaggerFromXML(XML xml) {

@Override
protected void saveStringTaggerToXML(XML xml) {
xml.addElement("fieldMatcher", fieldMatcher);
for (RegexFieldValueExtractor rfe : patterns) {
rfe.saveToXML(xml.addElement("pattern"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ public void testExtractFirst100ContentChars()
}

@Test
public void testWriteRead() {
public void testWriteRead() {
RegexTagger tagger = new RegexTagger();
tagger.getFieldMatcher().setPattern("(.*)(crawler)").partial();
tagger.addPattern("field1", "123.*890");
tagger.addPattern("field2", "abc.*xyz", 3);
tagger.addPattern(new RegexFieldValueExtractor("blah")
Expand Down

0 comments on commit 2fbdc6a

Please sign in to comment.