use of org.opengrok.suggest.query.SuggesterPrefixQuery in project OpenGrok by OpenGrok.
the class SuggesterQueryParser method newWildcardQuery.
@Override
protected Query newWildcardQuery(final Term t) {
if (t.text().contains(identifier)) {
String term = t.text().replace(identifier, "");
if (term.endsWith("*") && !containsWildcardCharacter(term.substring(0, term.length() - 1))) {
// the term ends with "*" but contains no other wildcard characters so faster method can be used
replaceIdentifier(t.field(), t.text());
term = term.substring(0, term.length() - 1);
SuggesterPrefixQuery q = new SuggesterPrefixQuery(new Term(t.field(), term));
this.suggesterQuery = q;
return q;
} else {
SuggesterWildcardQuery q = new SuggesterWildcardQuery(replaceIdentifier(t, identifier));
replaceIdentifier(t.field(), t.text());
this.suggesterQuery = q;
return q;
}
}
return super.newWildcardQuery(t);
}
use of org.opengrok.suggest.query.SuggesterPrefixQuery in project OpenGrok by OpenGrok.
the class SuggesterQueryParser method newPrefixQuery.
@Override
protected Query newPrefixQuery(final Term prefix) {
if (prefix.text().contains(identifier)) {
SuggesterPrefixQuery q = new SuggesterPrefixQuery(replaceIdentifier(prefix, identifier));
this.suggesterQuery = q;
return q;
}
return super.newPrefixQuery(prefix);
}
Aggregations