Repository navigation
#158 remove the DOM-based LDJsonParseFilter and LinkParseFilter - #2253
Conversation
Their JSoupFilter equivalents in org.apache.stormcrawler.jsoup do not need a DOM. Also delegate needsDOM() in the OpenSearch JSONResourceWrapper and remove the unused DOM-based RobotsTags.extractMetaTags(DocumentFragment). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rzo1
left a comment
There was a problem hiding this comment.
LGTM, and thanks for documenting the JSoupFilters. One question: JSoupFilters only run in JSoupParserBolt, so anyone using the Tika ParserBolt for HTML with the removed LinkParseFilter has no replacement. You kept parse.filter.XPathFilter for that reason; should the migration note say so, or should LinkParseFilter stay for Tika as well? Could the note also mention that RobotsTags.extractMetaTags(DocumentFragment) is gone?
The Tika bolt is getting support for JSOUP filters in #2256 |
Related to #158. As the next release is a major one, the DOM-based filters that have a JSoupFilter equivalent are removed rather than deprecated.
Changes
org.apache.stormcrawler.parse.filter.LDJsonParseFilterandorg.apache.stormcrawler.parse.filter.LinkParseFilter. Their JSoupFilter equivalents,org.apache.stormcrawler.jsoup.LDJsonParseFilterandorg.apache.stormcrawler.jsoup.LinkParseFilter, are already used by the archetypes.jsoup.LDJsonParseFilteruses a CSS selector and does not need a DOM at all.JSONResourceWrapper(OpenSearch) now delegatesneedsDOM()to the filter it wraps; it used to always returnfalse, so a wrapped filter requiring the DOM would get anulldocument. AddedJSONResourceWrapperTest.RobotsTags.extractMetaTags(DocumentFragment), which was not called anywhere (JSoupParserBoltuses theStringvariant), along with its static XPath expression.test.parsefilters.jsonand the corresponding test inXPathFilterTest; the JSoup version is covered byJsoupFilterTestandJSoupFiltersTest.internals.adoc(interface, configuration, order relative to the ParseFilters, list of the provided implementations with their syntax),jsoup.filters.config.fileto the configuration reference, and a mention inarchitecture.adoc.Migration
Users with either filter in
parsefilters.jsonneed to move it tojsoupfilters.jsonwith theorg.apache.stormcrawler.jsoupclass name. The parameters ofLDJsonParseFilterare unchanged. The XPath expressions ofLinkParseFilterkeep working for attributes (e.g.//IMG/@src); element names are lowercased automatically.parse.filter.XPathFilteris kept for now: its expression syntax differs from the JSoup version (string()andserialize()) and it is the only XPath extraction available to the TikaParserBolt.🤖 Generated with Claude Code