You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by to...@apache.org on 2022/05/08 07:05:11 UTC

[lucene] branch branch_9x updated: LUCENE-10059: Apply the same change to KoreanTokenizer

This is an automated email from the ASF dual-hosted git repository.

tomoko pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new cbf2e64c44f LUCENE-10059: Apply the same change to KoreanTokenizer
cbf2e64c44f is described below

commit cbf2e64c44f4a9e35afd22aefa51a2ac52c79b2d
Author: Tomoko Uchida <to...@gmail.com>
AuthorDate: Sun May 8 16:04:49 2022 +0900

    LUCENE-10059: Apply the same change to KoreanTokenizer
---
 .../src/java/org/apache/lucene/analysis/ko/KoreanTokenizer.java  | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanTokenizer.java b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanTokenizer.java
index 325fae710b9..59a21d72a2d 100644
--- a/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanTokenizer.java
+++ b/lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/KoreanTokenizer.java
@@ -967,6 +967,15 @@ public final class KoreanTokenizer extends Tokenizer {
   private void backtrace(final Position endPosData, final int fromIDX) {
     final int endPos = endPosData.pos;
 
+    /**
+     * LUCENE-10059: If the endPos is the same as lastBackTracePos, we don't want to backtrace to
+     * avoid an assertion error {@link RollingCharBuffer#get(int)} when it tries to generate an
+     * empty buffer
+     */
+    if (endPos == lastBackTracePos) {
+      return;
+    }
+
     if (VERBOSE) {
       System.out.println(
           "\n  backtrace: endPos="