You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by md...@apache.org on 2019/12/20 04:51:07 UTC
[lucene-solr] branch master updated: SOLR-13190 Fix for failing test
This is an automated email from the ASF dual-hosted git repository.
mdrob pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new 1333bd1 SOLR-13190 Fix for failing test
1333bd1 is described below
commit 1333bd10a7b02df0c66a1e8a0af2714db3f75142
Author: Mike Drob <md...@apple.com>
AuthorDate: Thu Dec 19 18:37:53 2019 -0600
SOLR-13190 Fix for failing test
---
lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java | 9 +++++++--
.../core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java b/lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java
index 279f9e7..c5e3eee 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FuzzyQuery.java
@@ -28,6 +28,7 @@ import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.ByteRunAutomaton;
import org.apache.lucene.util.automaton.LevenshteinAutomata;
import org.apache.lucene.util.automaton.Operations;
+import org.apache.lucene.util.automaton.TooComplexToDeterminizeException;
/** Implements the fuzzy search query. The similarity measurement
* is based on the Damerau-Levenshtein (optimal string alignment) algorithm,
@@ -163,8 +164,12 @@ public class FuzzyQuery extends MultiTermQuery {
visitor.consumeTerms(this, term);
} else {
// Note: we're rebuilding the automaton here, so this can be expensive
- visitor.consumeTermsMatching(this, field,
- new ByteRunAutomaton(toAutomaton(), false, Operations.DEFAULT_MAX_DETERMINIZED_STATES));
+ try {
+ visitor.consumeTermsMatching(this, field,
+ new ByteRunAutomaton(toAutomaton(), false, Operations.DEFAULT_MAX_DETERMINIZED_STATES));
+ } catch (TooComplexToDeterminizeException e) {
+ throw new FuzzyTermsEnum.FuzzyTermsException(term.text(), e);
+ }
}
}
}
diff --git a/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java b/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java
index 91c67c0..6f5da72 100644
--- a/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java
+++ b/lucene/core/src/java/org/apache/lucene/search/FuzzyTermsEnum.java
@@ -419,7 +419,7 @@ public final class FuzzyTermsEnum extends BaseTermsEnum {
* but also possible with shorter terms consisting of UTF-32 code points.
*/
public static class FuzzyTermsException extends RuntimeException {
- private FuzzyTermsException(String term, Throwable cause) {
+ FuzzyTermsException(String term, Throwable cause) {
super("Term too complex: " + term, cause);
}
}