Interface SearchQuery
- All Known Implementing Classes:
AbstractSearchQuery,EventSearchQuery,SeriesSearchQuery
public interface SearchQuery
Interface for the implementation of search queries.
-
Method Summary
Modifier and TypeMethodDescriptionString[]Returns the fields that should be returned by the query.Returns the filter expression.intgetLimit()Returns the number of results that are returned, starting at the offset returned bygetOffset().intReturns the starting offset within the search result or0if no offset was specified.Returns the search text ornullif no text was specified.getSortOrder(String field) Returns the sort order of a field.Returns all the known sort orders.getTerms()Returns the search terms or an empty collection if no terms were specified.String[]getTypes()Returns the document types or or an empty array if no types were specified.booleanReturnstrueif the current search operation should be performed using fuzzy searching.Adds a field that needs to be returned by the query.withFields(String... fields) Adds the fields that need to be returned by the query.withFilter(String filter) Returns documents that match the search query and the text filter.withLimit(int limit) Sets the number of results that are returned.withOffset(int offset) Sets the starting offset.withSortOrder(String field, SortCriterion.Order order) Sort the result set by the field and the given order.Returns documents that contain the given text.withText(boolean fuzzy, SearchTerms.Quantifier quantifier, String... text) Returns documents that contain the given text.Returns documents that contain the given text.Return documents of the given types.
-
Method Details
-
withTypes
Return documents of the given types.- Parameters:
types- the resource types to look up- Returns:
- the query extended by this criterion
-
getTypes
String[] getTypes()Returns the document types or or an empty array if no types were specified.- Returns:
- the type
-
withLimit
Sets the number of results that are returned.- Parameters:
limit- the number of results- Returns:
- the search query
-
getLimit
int getLimit()Returns the number of results that are returned, starting at the offset returned bygetOffset(). If no limit was specified, this method returns-1.- Returns:
- the maximum number of results
-
withOffset
Sets the starting offset. Search results will be returned starting at that offset and until the limit is reached, as specified bygetLimit().- Parameters:
offset- the starting offset- Returns:
- the search query
-
getOffset
int getOffset()Returns the starting offset within the search result or0if no offset was specified.- Returns:
- the offset
-
withText
Returns documents that contain the given text.- Parameters:
text- the text to look up- Returns:
- the query extended by this criterion
-
withText
Returns documents that contain the given text.- Parameters:
wildcardSearch-Trueto perform a (much slower) wildcard searchtext- the text to look up- Returns:
- the query extended by this criterion
-
withText
Returns documents that contain the given text.Depending on the quantifier, either documents are returned that contain at least one of the terms are only documents containing all of the terms.
- Parameters:
fuzzy-trueto perform a fuzzy searchquantifier- whether all or some of the terms need to be matchedtext- the text to look up- Returns:
- the query extended by this criterion
-
getTerms
Collection<SearchTerms<String>> getTerms()Returns the search terms or an empty collection if no terms were specified.- Returns:
- the terms
-
getQueryString
String getQueryString()Returns the search text ornullif no text was specified.- Returns:
- the text
-
isFuzzySearch
boolean isFuzzySearch()Returnstrueif the current search operation should be performed using fuzzy searching.- Returns:
trueif fuzzy search should be used
-
withFilter
Returns documents that match the search query and the text filter.- Parameters:
filter- the filter text- Returns:
- the search query
-
getFilter
String getFilter()Returns the filter expression.- Returns:
- the filter
-
getFields
String[] getFields()Returns the fields that should be returned by the query. If all fields should be returned, the method will return an empty array.- Returns:
- the names of the fields to return
-
withField
Adds a field that needs to be returned by the query. If no fields are being set, all fields will be returned.- Parameters:
field- the field name- Returns:
- the query
-
withFields
Adds the fields that need to be returned by the query. If no fields are being set, all fields will be returned.- Parameters:
fields- the field names- Returns:
- the query
-
withSortOrder
Sort the result set by the field and the given order. The insertion-order is kept.- Parameters:
field- the field name, must not benullorder- the order direction, must not benull- Returns:
- the updated search query
-
getSortOrders
Map<String,SortCriterion.Order> getSortOrders()Returns all the known sort orders. The insertion-order is kept.- Returns:
- a map with all known sort orders
-
getSortOrder
Returns the sort order of a field. If no sort order has been set for the given field,SortCriterion.Order.Noneis returned.- Parameters:
field- the field name, must not benull- Returns:
- the sort order
-