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

Thomas Mueller commented on OAK-3000:
-------------------------------------

For me, the new test "highlightWithWildCard" fails. It says:

{noformat}
org.junit.ComparisonFailure: expected:
<<div><span>[fox is <strong>jumping</strong>]</span></div>> 
but was:
<<div><span>[<strong>fox</strong> is jumping]</span></div>>
{noformat}

I'm not sure if the patch is correct. Debugging the code, it will try to 
highlight "fox" and then "*". Highlighting "fox" works, but highlighting "*" 
would highlight the character "*". But I don't think the wildcard character 
should be handled like this. I would expect it to be ignored:

{noformat}
    @Test
    public void highlightIgnoreStar() throws Exception {
        assertEquals("<div><span>10 * 10</span></div>",
                highlight(sb("10 * 10"), of("fox *")));
    }
{noformat}

A bit unexpected (I would call it a bug) is that you can highlight the 
intermediate HTML. That way, you can generate a strange, and very long result. 
For example, this results in a 300 KB (!) long string:

{noformat}
highlight(sb("abc"), of("a < > o n st ng> ng on ong /")))
{noformat}


> SimpleExcerptProvider causes OOM for some wildcard expressions
> --------------------------------------------------------------
>
>                 Key: OAK-3000
>                 URL: https://issues.apache.org/jira/browse/OAK-3000
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: query
>            Reporter: Chetan Mehrotra
>             Fix For: 1.3.1, 1.2.3, 1.0.16
>
>         Attachments: OAK-3000.patch
>
>
> {{SimpleExcerptProvider}} would cause OOM is the search expression involves 
> wildcard in following form
> bq. fox *
> This causes an infinite loop leading to OOM



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to