List of usage examples for org.apache.lucene.search FuzzyQuery defaultMaxEdits
int defaultMaxEdits
To view the source code for org.apache.lucene.search FuzzyQuery defaultMaxEdits.
Click Source Link
From source file:org.exist.indexing.lucene.XMLToQuery.java
License:Open Source License
private Query fuzzyQuery(String field, Element node) throws XPathException { int maxEdits = FuzzyQuery.defaultMaxEdits; String attr = node.getAttribute("max-edits"); if (attr != null && attr.length() > 0) { try {//w w w.j a v a2s .c om maxEdits = Integer.parseInt(attr); if (maxEdits < 0 || maxEdits > LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE) { throw new XPathException("Query parameter max-edits must by <= " + LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE); } } catch (NumberFormatException e) { throw new XPathException("Query parameter 'max-edits' should be an integer value. Got: " + attr); } } return new FuzzyQuery(new Term(field, getText(node)), maxEdits); }