TermsEnum termEnum = terms.iterator(null);
int i = 1;
BytesRef term = termEnum.next();
while (term != null && i++ < maxNumberOfTerms) {
String text = term.utf8ToString();
if (termEnum.docFreq() >= threshold) {
String analyzedText = LuceneSearcher.analyzeText(fieldName, text, analyzer);
if ((startsWithOnly && StringUtils.startsWithIgnoreCase(analyzedText, analyzedSearchValue))
|| (!startsWithOnly && StringUtils.containsIgnoreCase(analyzedText, analyzedSearchValue))
|| (startsWithOnly && StringUtils.startsWithIgnoreCase(text, searchValueWithoutWildcard))
|| (!startsWithOnly && StringUtils.containsIgnoreCase(text, searchValueWithoutWildcard))) {