Search in sources :

Example 6 with TermSuggestionQuery

use of com.enonic.xp.query.suggester.TermSuggestionQuery in project xp by enonic.

the class SuggestionQueriesTest method testBuilder.

@Test
public void testBuilder() {
    final TermSuggestionQuery query = TermSuggestionQuery.create("queryName").field("category").text("value").analyzer("analyzer").size(1).maxEdits(2).prefixLength(3).minWordLength(4).maxInspections(5).minDocFreq(6f).maxTermFreq(7f).sort(TermSuggestionQuery.Sort.FREQUENCY).suggestMode(TermSuggestionQuery.SuggestMode.ALWAYS).stringDistance(TermSuggestionQuery.StringDistance.INTERNAL).build();
    final SuggestionQueries queries = SuggestionQueries.create().add(query).build();
    assertNotNull(queries);
    assertTrue(queries.isNotEmpty());
    assertTrue(queries.contains(query));
}
Also used : SuggestionQueries(com.enonic.xp.query.suggester.SuggestionQueries) TermSuggestionQuery(com.enonic.xp.query.suggester.TermSuggestionQuery) Test(org.junit.jupiter.api.Test)

Aggregations

TermSuggestionQuery (com.enonic.xp.query.suggester.TermSuggestionQuery)6 Test (org.junit.jupiter.api.Test)4 TermSuggestionBuilder (org.elasticsearch.search.suggest.term.TermSuggestionBuilder)3 SuggestionQueries (com.enonic.xp.query.suggester.SuggestionQueries)1 SuggestionQuery (com.enonic.xp.query.suggester.SuggestionQuery)1 HashSet (java.util.HashSet)1 SuggestBuilder (org.elasticsearch.search.suggest.SuggestBuilder)1