Skip to content

#158 remove the DOM from the ParseFilters - #2262

Merged
jnioche merged 2 commits into
mainfrom
remove-DOM
Oct 24, 2026
Merged

jnioche merged 2 commits into
mainfrom
remove-DOM

Conversation

@jnioche

@jnioche jnioche commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #2252, #2253 and #2256 for #158.

Building a W3C DOM is costly, and since the JSoupFilters are now applied by both the JSoupParserBolt and the Tika ParserBolt, nothing in StormCrawler needs it any more. This removes the DOM from the parse filtering altogether.

Changes

  • API: ParseFilter.filter(String url, byte[] content, ParseResult parse) no longer takes a DocumentFragment; needsDOM() is removed. ParseFilters no longer skips filters for lack of a DOM.
  • Removed: the DOM-based parse.filter.XPathFilter (use jsoup.XPathFilter) and DebugParseFilter.
  • Parser bolts: JSoupParserBolt and the Tika ParserBolt no longer build a DOM. DocumentFragmentBuilder (core) and DOMBuilder / XMLCharacterRecognizer (Tika) are removed, along with the Tika option parser.uppercase.element.names, which only applied to the DOM.
  • Dependencies: xercesImpl is dropped from core.
  • Updated all ParseFilter implementations (core, langid, playwright, opensearch JSONResourceWrapper), the tests and the documentation.

Breaking changes (for the 4.0 migration notes)

  • Custom ParseFilters must drop the DocumentFragment argument and any needsDOM() override. Filters which extracted data from the DOM should be rewritten as JSoupFilters.
  • Configurations using org.apache.stormcrawler.parse.filter.XPathFilter must move to org.apache.stormcrawler.jsoup.XPathFilter in jsoupfilters.json. The expression syntax differs: string(...) / serialize(...) become /tidyText(), /allText(), /html() or /@attr.
  • parser.uppercase.element.names is no longer used.

Testing

Core parse / bolt / jsoup tests, all Tika tests, JsRenderingDetectorTest and DelegateRefresherTest pass locally.

🤖 Generated with Claude Code

ParseFilter.filter() no longer takes a DocumentFragment and needsDOM() is
removed. The parser bolts do not build a W3C DOM any more: extracting data
from the markup of a document is done with the JSoupFilters, which are now
applied by both the JSoupParserBolt and the Tika ParserBolt.

- remove the DOM-based XPathFilter and the DebugParseFilter
- remove DocumentFragmentBuilder (core) and DOMBuilder /
  XMLCharacterRecognizer (Tika), as well as the now unused
  parser.uppercase.element.names option of the Tika ParserBolt
- drop the xercesImpl dependency from core
- update the ParseFilter implementations, tests and documentation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jnioche
jnioche merged commit db7aff0 into main Oct 24, 2026
2 checks passed
@jnioche
jnioche deleted the remove-DOM branch October 24, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants