You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Elliot Z. Lin (Jira)" <ji...@apache.org> on 2022/08/15 23:56:00 UTC

[jira] [Commented] (LUCENE-2587) Highlighter picks wrong offset for fragment boundaries

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

Elliot Z. Lin commented on LUCENE-2587:
---------------------------------------

Jumping in here to revive this decade-old issue. Roberto, I carried on your work, applied your patch, and verified that the issue still persists. I wrote an additional test to demonstrate the contiguity bug and implemented a fix. This is currently in PR.

> Highlighter picks wrong offset for fragment boundaries
> ------------------------------------------------------
>
>                 Key: LUCENE-2587
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2587
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/highlighter
>    Affects Versions: 3.0.2
>         Environment: Java 6 + Lucene 3.0.2
>            Reporter: Terje Eggestad
>            Priority: Trivial
>              Labels: newdev
>         Attachments: IMSentenceFragmenter.java, LUCENE-2587.patch, TestIMSentenceFragmenter.java
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> I have written  a new Fragmenter since we need fragments for hitlines to be on sentence boundaries and not cross paragraphs. 
> When using it with org.apache.lucene.search.highlight.Highlighter, I get hitlines that starts with ". ", "? ", "! "...
> Consider the text  "A b c d e. F g h i j! K l m n o. " 
> which become the tokenstream : (A) (b) (c) (d) (e) (F) (g) (h) (i) (j) (K) (l) (m) (n) (o)  
> If the fragmenter return isNewFragment()  = true on F and K and Highlighter pick the middle fragment, lets say we search on "g" the hitline becomes:
> ". F <B>g</B> h i j"
> The reason, it seems, is that the offset to the fragment boundaries found by taking the endOffset of the last token in a fragment , 
> not the startOffset of the first. 
> TJ



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org