From dev-return-354838-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Fri May 3 12:03:04 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id F347A18064D for ; Fri, 3 May 2019 14:03:03 +0200 (CEST) Received: (qmail 4457 invoked by uid 500); 3 May 2019 12:03:01 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 4445 invoked by uid 99); 3 May 2019 12:03:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 May 2019 12:03:01 +0000 Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B969FE02EC for ; Fri, 3 May 2019 12:03:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 4D4FC24597 for ; Fri, 3 May 2019 12:03:00 +0000 (UTC) Date: Fri, 3 May 2019 12:03:00 +0000 (UTC) From: "Robert Muir (JIRA)" To: dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (LUCENE-8776) Start offset going backwards has a legitimate purpose MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-8776?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D168= 32449#comment-16832449 ]=20 Robert Muir commented on LUCENE-8776: ------------------------------------- I don't think we should change the exception message at all. Please remember: the code is open source, you can modify the source code fo= r whatever purpose. So I think such a message comes out wrong, I don't even buy the argument th= at it "broke" anything: we're not putting a gun to your head and forcing yo= u to upgrade or anything. You can stay on an older version of the code, you= can fork the code and modify it, all kinds of solutions. > Start offset going backwards has a legitimate purpose > ----------------------------------------------------- > > Key: LUCENE-8776 > URL: https://issues.apache.org/jira/browse/LUCENE-8776 > Project: Lucene - Core > Issue Type: Bug > Components: core/search > Affects Versions: 7.6 > Reporter: Ram Venkat > Priority: Major > > Here is the use case where startOffset can go backwards: > Say there is a line "Organic light-emitting-diode glows", and I want to r= un span queries and highlight them properly.=C2=A0 > During index time, light-emitting-diode is split into three words, which = allows me to search for 'light', 'emitting' and 'diode' individually. The t= hree words occupy adjacent positions in the index, as 'light' adjacent to '= emitting' and 'light' at a distance of two words from 'diode' need to match= this word. So, the order of words after splitting are: Organic, light, emi= tting, diode, glows.=C2=A0 > But, I also want to search for 'organic' being adjacent to 'light-emittin= g-diode' or 'light-emitting-diode' being adjacent to 'glows'.=C2=A0 > The way I solved this was to also generate 'light-emitting-diode' at two = positions: (a) In the same position as 'light' and (b) in the same position= as 'glows', like below: > ||organic||light||emitting||diode||glows|| > |=C2=A0|light-emitting-diode|=C2=A0|light-emitting-diode|=C2=A0| > |0|1|2|3|4| > The positions of the two 'light-emitting-diode' are 1 and 3, but the offs= ets are obviously the same. This works beautifully in Lucene 5.x in both se= arching and highlighting with span queries.=C2=A0 > But when I try this in Lucene 7.6, it hits the condition "Offsets must no= t go backwards" at DefaultIndexingChain:818. This IllegalArgumentException = is being thrown without any comments on why this check is needed. As I expl= ained above, startOffset going backwards is perfectly valid, to deal with w= ord splitting and span operations on these specialized use cases. On the ot= her hand, it is not clear what value is added by this check and which highl= ighter code is affected by offsets going backwards. This same check is done= at BaseTokenStreamTestCase:245.=C2=A0 > I see others talk about how this check found bugs in WordDelimiter etc. b= ut it also prevents legitimate use cases. Can this check be removed?=C2=A0= =C2=A0 -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org