From 419ffd3974e4892fa3d5ca9d22477f72559b490d Mon Sep 17 00:00:00 2001 From: Peter Gromov Date: Mon, 31 Oct 2022 10:08:32 +0100 Subject: [PATCH] [hunspell] perform a bit fewer checks after 2 suffixes have been removed --- .../src/java/org/apache/lucene/analysis/hunspell/Stemmer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java index 0e11d457c3c..3b2fe4370f0 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Stemmer.java @@ -614,6 +614,8 @@ final class Stemmer { return false; } + if (innerSuffix >= 0) return true; + int recursionDepth = (outerSuffix >= 0 ? 1 : 0) + (innerPrefix >= 0 ? 2 : outerPrefix >= 0 ? 1 : 0) - 1; if (dictionary.isCrossProduct(affix) && recursionDepth <= 1) {