Skip to content

SiteMapParserBolt: strict parsing, opt-in sniffing, non-terminal parse failure - #2125

Open
abhinav-phi wants to merge 1 commit into
apache:mainfrom
abhinav-phi:issue-2083-sitemapparser-strict
Open

SiteMapParserBolt: strict parsing, opt-in sniffing, non-terminal parse failure#2125
abhinav-phi wants to merge 1 commit into
apache:mainfrom
abhinav-phi:issue-2083-sitemapparser-strict

Conversation

@abhinav-phi

Copy link
Copy Markdown
Contributor

Fixes #2083.

  • Strict parsing (sitemap.strict, default true): crawler-commons then discards URLs a sitemap lists on hosts other than its own — previously a sitemap could enrol URLs on any host, and those entries skipped parser.emitOutlinks.max.per.page and the robots meta tags of the HTML path.
  • Opt-in sniffing (sitemap.sniffContent, default false, like feed.sniffContent for feeds): any HTML page carrying the sitemaps.org namespace string in its first bytes was reclassified as a sitemap, never reached the parser bolt and was never indexed. The key SiteMapParserBoltTest already set but the bolt ignored is now honoured; a content type which rules a sitemap out (a page served as HTML) stops the sniffing when it is enabled.
  • Non-terminal parse failure: a document marked as a sitemap through persisted metadata whose body does not parse is emitted as FETCH_ERROR with the isSitemap key dropped, instead of a terminal ERROR. With the archetype's fetchInterval.error: -1 an ERROR removed the URL from the crawl for good — in an open crawl that lets a third party remove other people's URLs from the corpus. On its next fetch the document goes to the parser bolt like any other page.

Release note needed: strict parsing and the sniffing default both change what an existing crawl discovers.

Test resources: the image / all-extensions sitemaps listed their first URL on www.example.com, which strict mode now correctly excludes; that entry moved under the sitemap's own host.

…e failure (apache#2083)

- the parser is now built in strict mode (sitemap.strict, default
  true): crawler-commons then discards URLs a sitemap lists on hosts
  other than its own, so a sitemap cannot enrol URLs on hosts it has
  nothing to do with, and an HTML page mentioning the sitemap namespace
  is not parsed leniently into half a sitemap
- content sniffing moves behind sitemap.sniffContent (default false,
  like feed.sniffContent for feeds): a page carrying the namespace
  string in its first bytes was reclassified as a sitemap, never
  reached the parser bolt and was never indexed. The key the existing
  test already set but the bolt ignored is now honoured; a content type
  which rules a sitemap out (a page served as HTML) stops the sniffing
- a document marked as a sitemap through persisted metadata whose body
  does not parse is emitted as FETCH_ERROR with the isSitemap key
  dropped, instead of a terminal ERROR: with the archetype's
  fetchInterval.error of -1, an ERROR removed the URL from the crawl
  for good, letting whoever controls the content decide what stays in
  the corpus. On its next fetch the document goes to the parser bolt
  like any other page

The image and all-extensions test sitemaps listed their first URL on
www.example.com, which strict mode now correctly excludes; that entry
moved under the sitemap's own host.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SiteMapParserBolt sniffs every document, parses sitemaps non-strict, and turns a failed sitemap parse into a terminal ERROR

1 participant