diff --git a/src/java/org/apache/lucene/search/WildcardTermEnum.java b/src/java/org/apache/lucene/search/WildcardTermEnum.java index 9af4de9837a..092b469e9b5 100644 --- a/src/java/org/apache/lucene/search/WildcardTermEnum.java +++ b/src/java/org/apache/lucene/search/WildcardTermEnum.java @@ -75,7 +75,11 @@ public class WildcardTermEnum extends FilteredTermEnum { boolean fieldMatch = false; boolean endEnum = false; - /** Creates new WildcardTermEnum */ + /** + * Creates a new WildcardTermEnum. Passing in a + * {@link org.apache.lucene.index.Term} that does not contain a + * WILDCARD_CHAR will cause an exception to be thrown. + */ public WildcardTermEnum(IndexReader reader, Term term) throws IOException { super(reader, term); searchTerm = term; @@ -85,8 +89,12 @@ public class WildcardTermEnum extends FilteredTermEnum { int sidx = text.indexOf(WILDCARD_STRING); int cidx = text.indexOf(WILDCARD_CHAR); int idx = sidx; - if (idx == -1) idx = cidx; - else if (cidx >= 0) idx = Math.min(idx, cidx); + if (idx == -1) { + idx = cidx; + } + else if (cidx >= 0) { + idx = Math.min(idx, cidx); + } pre = searchTerm.text().substring(0,idx); preLen = pre.length();