LUCENE-9770: Hunspell: don't perform compound check recursively when looking for space-separated word pairs (#2368)

This commit is contained in:
Peter Gromov 2021-02-15 20:20:19 +01:00 committed by GitHub
parent f1a1165ac8
commit b20e277569
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -311,11 +311,12 @@ public class Hunspell {
return false;
}
String spaceSeparated =
new String(tail.chars, tail.offset, length)
+ " "
+ new String(tail.chars, tail.offset + length, nextPartLength);
return !checkWord(spaceSeparated);
char[] spaceSeparated = new char[length + nextPartLength + 1];
System.arraycopy(tail.chars, tail.offset, spaceSeparated, 0, length);
System.arraycopy(
tail.chars, tail.offset + length, spaceSeparated, length + 1, nextPartLength);
spaceSeparated[length] = ' ';
return !Boolean.TRUE.equals(checkSimpleWord(spaceSeparated, spaceSeparated.length, null));
}
private boolean isMisspelledSimpleWord(int length, WordCase originalCase) {