jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benjamin Papez (JIRA)" <j...@apache.org>
Subject [jira] [Created] (JCR-3533) Inconsistent position of highlighted text in excerpt
Date Fri, 15 Mar 2013 07:46:13 GMT
Benjamin Papez created JCR-3533:
-----------------------------------

             Summary: Inconsistent position of highlighted text in excerpt
                 Key: JCR-3533
                 URL: https://issues.apache.org/jira/browse/JCR-3533
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: query
    Affects Versions: 2.6, 2.4, 2.2
            Reporter: Benjamin Papez
            Priority: Minor


We have noticed a strange behaviour with search excerpts. It sometimes cut the sentence at
the top of the search term and sometimes a little bit before.

When debugging we found in DefaultHighlighter.mergeFragments when iterating through the bestFragmentsList,
the following: 

            if (skip >= surround) {
                if (i > 0) {
                    skip -= surround;
                }
                // skip
                reader.skip((long) skip);
                pos += skip;
            }

So for the first element of the bestFragmentsList (when i == 0), you don't subtract the surround
from skip, so the excerpt starts with the found term and the context before the term is not
shown. Why is the first fragment treated differently than the others? We would rather expect
displaying the "surrounding" context also for the first fragment.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message