Class SearchQuery
java.lang.Object
com.codename1.backend.search.SearchQuery
What to search for: text, exact filters, an order, a page, and the fields to count facet values of.
SearchQuery q = new SearchQuery("red running shoes")
.fields("name", "description")
.filter("brand", "acme")
.facet("color")
.page(0, 20);
-
Constructor Summary
ConstructorsConstructorDescriptionSearchQuery(String text) A query fortext; null or empty matches every document. -
Method Summary
Modifier and TypeMethodDescriptionCounts the values offieldover all matches, inSearchResult.getFacets().Matches only in these fields instead of every string.Keeps only documents whosefieldequalsvalueexactly.The facet fields.The fields to match in; empty for all.Field to exact value.intgetFrom()Hits skipped.intgetSize()Hits returned at most.The sort field, or null for relevance.getText()The text, trimmed; empty matches everything.highlight(boolean on) Asks for highlighted fragments of the matched text.booleanWhether highlights were asked for.booleanWhether the sort is ascending.page(int from, int size) The page: skipfromhits and return at mostsize.Orders by a field instead of by relevance.
-
Constructor Details
-
SearchQuery
A query fortext; null or empty matches every document.
-
-
Method Details
-
fields
Matches only in these fields instead of every string. -
filter
Keeps only documents whosefieldequalsvalueexactly. Several filters must all hold. -
sort
Orders by a field instead of by relevance. -
page
The page: skipfromhits and return at mostsize. -
facet
Counts the values offieldover all matches, inSearchResult.getFacets(). On Elasticsearch and OpenSearch the field must be a keyword field -- with dynamic mapping,name.keywordforname. -
highlight
Asks for highlighted fragments of the matched text. -
getText
The text, trimmed; empty matches everything. -
getFields
The fields to match in; empty for all. -
getFilters
Field to exact value. -
getFacets
The facet fields. -
getSortField
The sort field, or null for relevance. -
isSortAscending
public boolean isSortAscending()Whether the sort is ascending. -
getFrom
public int getFrom()Hits skipped. -
getSize
public int getSize()Hits returned at most. -
isHighlight
public boolean isHighlight()Whether highlights were asked for.
-