Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0A54CE55A for ; Fri, 15 Mar 2013 07:46:22 +0000 (UTC) Received: (qmail 8461 invoked by uid 500); 15 Mar 2013 07:46:21 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 7334 invoked by uid 500); 15 Mar 2013 07:46:15 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 6990 invoked by uid 99); 15 Mar 2013 07:46:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Mar 2013 07:46:13 +0000 Date: Fri, 15 Mar 2013 07:46:13 +0000 (UTC) From: "Benjamin Papez (JIRA)" To: dev@jackrabbit.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (JCR-3533) Inconsistent position of highlighted text in excerpt MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 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