You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "waziqi89 (via GitHub)" <gi...@apache.org> on 2023/04/03 15:31:24 UTC

[GitHub] [lucene] waziqi89 opened a new issue, #12221: BaseFragmentsBuilder doesn't calculate the endOffset properly in FVH

waziqi89 opened a new issue, #12221:
URL: https://github.com/apache/lucene/issues/12221

   ### Description
   
   This is an issue found in BaseFragmentsBuilder. It makes FVH could potentially append the first word from the next field under a multiValue field to the fragment.
   
   To reproduce it:
   1. We need to use FVH to highlight a multiValue field
   2. We need to use ScoreFragListBuilder allow the fragment building order is not the indexing order
   3. We need to have a document whose best matched fragments is not from the first indexed field
   4. We need the fragment size large enough, so the fragment's end offset could be larger than the field end offset
   5. We need to fetch not only the top fragments (i.e. maxNumFragments > 1 )
   6. FVH fetches the fragments from the fields which are indexed before the best matched field
   
   To make it easier to understand, I created a branch with a [test case](https://github.com/apache/lucene/commit/70aaf684196605c0eef315766383cd8f29d9848f#diff-6e5c26b879d097826a8739ee7ca1efaa4b908d12a5a5d6a8c9fc0c5f146573e9R68).
   
   Note that
   The last word "Second" comes from a different field.
   
   
   
   ### Version and environment details
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [lucene] waziqi89 commented on issue #12221: BaseFragmentsBuilder doesn't calculate the endOffset properly in FastVectorHighlighter(FVH)

Posted by "waziqi89 (via GitHub)" <gi...@apache.org>.
waziqi89 commented on issue #12221:
URL: https://github.com/apache/lucene/issues/12221#issuecomment-1494711531

   Created a PR with the fix https://github.com/apache/lucene/pull/12222


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [lucene] waziqi89 commented on issue #12221: BaseFragmentsBuilder doesn't calculate the endOffset properly in FVH

Posted by "waziqi89 (via GitHub)" <gi...@apache.org>.
waziqi89 commented on issue #12221:
URL: https://github.com/apache/lucene/issues/12221#issuecomment-1494557233

   The root cause is it is that, while creating the `WeightedFragInfo` in [discreteMultiValueHighlighting](https://github.com/apache/lucene/blob/main/lucene/highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java#L372), the `FragEnd` is the first char after the fragment, so we need to use `FragEnd - 1` instead.
   This is not a problem when fetching one field only because of a [safeguard mechanism](https://github.com/apache/lucene/blob/main/lucene/highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java#L254) in buffer to avoid go beyond the buffer size, and the buffer starts build until the field which contains the best match ends when creating the first fragment.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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