mirror of https://github.com/apache/lucene.git
SOLR-13190 Fix for failing test
This commit is contained in:
parent
aab3c5faa3
commit
1333bd10a7
|
@ -28,6 +28,7 @@ import org.apache.lucene.util.automaton.Automaton;
|
||||||
import org.apache.lucene.util.automaton.ByteRunAutomaton;
|
import org.apache.lucene.util.automaton.ByteRunAutomaton;
|
||||||
import org.apache.lucene.util.automaton.LevenshteinAutomata;
|
import org.apache.lucene.util.automaton.LevenshteinAutomata;
|
||||||
import org.apache.lucene.util.automaton.Operations;
|
import org.apache.lucene.util.automaton.Operations;
|
||||||
|
import org.apache.lucene.util.automaton.TooComplexToDeterminizeException;
|
||||||
|
|
||||||
/** Implements the fuzzy search query. The similarity measurement
|
/** Implements the fuzzy search query. The similarity measurement
|
||||||
* is based on the Damerau-Levenshtein (optimal string alignment) algorithm,
|
* is based on the Damerau-Levenshtein (optimal string alignment) algorithm,
|
||||||
|
@ -163,8 +164,12 @@ public class FuzzyQuery extends MultiTermQuery {
|
||||||
visitor.consumeTerms(this, term);
|
visitor.consumeTerms(this, term);
|
||||||
} else {
|
} else {
|
||||||
// Note: we're rebuilding the automaton here, so this can be expensive
|
// Note: we're rebuilding the automaton here, so this can be expensive
|
||||||
visitor.consumeTermsMatching(this, field,
|
try {
|
||||||
new ByteRunAutomaton(toAutomaton(), false, Operations.DEFAULT_MAX_DETERMINIZED_STATES));
|
visitor.consumeTermsMatching(this, field,
|
||||||
|
new ByteRunAutomaton(toAutomaton(), false, Operations.DEFAULT_MAX_DETERMINIZED_STATES));
|
||||||
|
} catch (TooComplexToDeterminizeException e) {
|
||||||
|
throw new FuzzyTermsEnum.FuzzyTermsException(term.text(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -419,7 +419,7 @@ public final class FuzzyTermsEnum extends BaseTermsEnum {
|
||||||
* but also possible with shorter terms consisting of UTF-32 code points.
|
* but also possible with shorter terms consisting of UTF-32 code points.
|
||||||
*/
|
*/
|
||||||
public static class FuzzyTermsException extends RuntimeException {
|
public static class FuzzyTermsException extends RuntimeException {
|
||||||
private FuzzyTermsException(String term, Throwable cause) {
|
FuzzyTermsException(String term, Throwable cause) {
|
||||||
super("Term too complex: " + term, cause);
|
super("Term too complex: " + term, cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue