[
https://issues.apache.org/jira/browse/LUCENE-5740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14074516#comment-14074516
]
David Smiley commented on LUCENE-5740:
--------------------------------------
Due to tag balancing of embedded elements, it doesn't look so simple after all.
The current implementation only strips SCRIPT & STYLE tags which have special
rules but conveniently have no child elements. There's no need to balance
embedded elements because there aren't any. But to do this more generally, if
you strip <foo>, you'd want to ensure that it strips
<foo><bar><foo>hi</foo></bar></foo> correctly. Admittedly, the particular
application I'm working on strips link text content (<a>) and I'm not expecting
embedded tags of the same type... but nonetheless it seems wrong to have this
limitation.
If it did track the state, it would just need an integer depth counter
(tagDepthWithinStrippedTag) that would be incremented for each opening element
and decremented for each closing element within the current tag being stripped.
Not bad really.
What do you think [~steve_rowe]?
> Add stripContentOfTags option to HTMLStripCharFilter
> ----------------------------------------------------
>
> Key: LUCENE-5740
> URL: https://issues.apache.org/jira/browse/LUCENE-5740
> Project: Lucene - Core
> Issue Type: New Feature
> Components: modules/analysis
> Reporter: David Smiley
>
> HTMLStripCharFilter should have an option to strip out the sub-content of
> certain elements. It already does this for SCRIPT & STYLE but it should be
> configurable to add more. I don't want certain elements to have their
> contents to be searchable.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]