[ 
https://issues.apache.org/jira/browse/LUCENE-5740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14074644#comment-14074644
 ] 

Steve Rowe commented on LUCENE-5740:
------------------------------------

bq. 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.

Don't forget that HTMLStripCharFilter must be able to handle (i.e. not throw an 
error, and maximize useful extracted content).  Assuming you'll see closing 
tags could be a problem here; some HTML doesn't have these in some cases.

It might be better to just track nested tags of the same type as the current 
tag being stripped, rather than all tags - the other contained tags should be 
ignorable, I think.  (This condition - nested same-type tags - should be fairly 
rare, but will need to be handled, e.g. <ul><li><ul><li></li></ul></li></ul>.)

The other thing to worry about is the possible lack of closing tags for a tag 
the contents of which are to be stripped.  I'm not sure how to handle this - 
maybe look at how other HTML parsers do it?  (I.e., how to limit scope of 
never-closed tags.)


> 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
>            Assignee: 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]

Reply via email to