use of org.opengrok.suggest.query.SuggesterRegexpQuery in project OpenGrok by OpenGrok.
the class SuggesterSearcherTest method suggesterRegexpQueryTest.
@Test
public void suggesterRegexpQueryTest() {
List<LookupResultItem> suggestions = searcher.suggest(new TermQuery(new Term("test", "test")), "test", new SuggesterRegexpQuery(new Term("test", ".pengrok")), k -> 0);
List<String> tokens = suggestions.stream().map(LookupResultItem::getPhrase).collect(Collectors.toList());
assertThat(tokens, contains("opengrok"));
}
use of org.opengrok.suggest.query.SuggesterRegexpQuery in project OpenGrok by OpenGrok.
the class SuggesterQueryParser method newRegexpQuery.
@Override
protected Query newRegexpQuery(final Term regexp) {
if (regexp.text().contains(identifier)) {
Term newTerm = replaceIdentifier(regexp, identifier);
replaceIdentifier(regexp.field(), "/" + regexp.text() + "/");
SuggesterRegexpQuery q = new SuggesterRegexpQuery(newTerm);
this.suggesterQuery = q;
return q;
}
return super.newRegexpQuery(regexp);
}
Aggregations