Important
|
This stage is deprecated. Please use Forked Apache Tika Parser Stage instead. |
This parser stage processes the following HTML elements:
-
<title>
-
<body>
(with tags removed) -
<meta>
-
<a>
and<link>
Additionally, you can configure JSoup selectors to extract specific HTML and CSS elements from a document and map them to PipelineDocument fields.
For example, you could use this to process navigational DIV
elements one way, then process content-ful DIV
elements another way.
Note
|
The HTML Transformation index pipeline stage is deprecated in favor of this parser stage. |
HTML and CSS elements can be selected for extraction into new documents or fields:
-
To create new documents from selected elements, configure
recordSelector
. -
To create new fields from selected elements, configure
mappings
.
Title, body, metadata, and links are only populated in the parent document. Both of these parameters support JSoup selectors, which provides a rich syntax for selecting HTML and CSS elements.
Tip
|
When entering configuration values in the UI, use unescaped characters, such as \t for the tab character. When entering configuration values in the API, use escaped characters, such as \\t for the tab character.
|
HTML Content Extraction
The Context Extraction setting in the HTML Parser has a special meaning.
By default, when unchecked or false, the HTML parser will essentially attempt to extract the text of the entire HTML page as the text that will be used in the Solr document.
However, when Content Extract is checked, or true, a set of heuristic rules are applied to attempt to automatically determine what node in the entire page is most likely to be the page content, based on the tree of nodes inside it and the text component of all the sub-nodes.
This may be helpful when you have a variety of different page formats, and also significant text on the pages which is not useful to add to the documents, such as significant text in the page header or footer.
However, since the algorithm is based on heuristics , it is possible that the results could change as the site is altered. When you need a high degree of certainty, we recommend that you use explicit rules of which nodes to extract to match your local configuration.
HTML stage-specific properties
Property | Description, Type |
---|---|
charset
Character Set required |
Example: "UTF-8" type: default value: ' |
contentExtractionConfig
Content extraction |
Extract rich formatted content and metadata type: object attributes: { |
enabled
Enable this Parser Stage |
type: default value: ' |
errorHandling
Error Handling |
type: default value: ' enum: { ignore log fail mark } |
excludeFilters
Exclude filters |
Jsoup-formatted selectors for elements to exclude from the HTML document. type: |
extractBodyText
Extract body as a text |
Extract body as a text type: default value: ' |
extractHtmlLinks
Extract HTML links |
Collect links explicitly declared in HTML document type: default value: ' |
filterBeforeExtractingLinks
Filter before extracting links |
Apply exclude filters before performing link extraction. type: default value: ' |
filterBeforeMapping
Filter before mapping |
Apply exclude filters before performing HTML field mapping. type: default value: ' |
id
Parser ID |
type: default value: ' |
ignoredMediaTypes
Media Types to ignore |
Documents with a media type on this list will be not be processed by this parser stage. type: |
inheritMediaTypes
Match default media types in this Parser Stage |
Each parser stage has a built-in list of media types it handles by default. If this setting is true, that list will be used along with any optional additional types provided in the mediaTypes list. If this setting is false, this stage will only be selected for media types in the mediaTypes list, and the mediaTypes list becomes a mandatory property which must have at least one valid media type. type: default value: ' |
keepParent
Keep Parent Document? |
Keep or discard parent document with selected records. Has no effect if Record Selector is not specified. type: default value: ' |
mappings
HTML Mappings |
type: object attributes: { |
mediaTypes
Media Types to match |
Documents with a media type on this list will be matched by this parser stage. See inheritMediaTypes / use default media types for more. type: |
metatagsPrefix
Optional prefix for metatags captured html document |
Optional prefix to add to metatags (except id and charset) captured from an html document to used as a fields as-is (id and charset get prefix) from document type: default value: ' |
outputFieldPrefix
Prefix parsed fields with |
Fields extracted by this parser will be prefixed with this string. The remainder of the field name will be as detected in the stream type: maxLength: 20 pattern: ^$|^[A-Za-z_][A-Za-z0-9_\-\.]+$ |
pathPatterns
File names to parse |
Specify a file name or pattern that must be matched for this parser stage to run. Forward slashes ("/") are used to join names of files inside archives with the archive name. type: object attributes: { } |
recordSelector
Record Selector |
type: |
type
required |
type: default value: ' enum: { html } |