Package org.gbif.api.model.common.search
Class BaseSearchRequest<P extends SearchParameter>
java.lang.Object
org.gbif.api.model.common.paging.PageableBase
org.gbif.api.model.common.search.BaseSearchRequest<P>
- All Implemented Interfaces:
Pageable,SearchRequest<P>
- Direct Known Subclasses:
DatasetSuggestRequest,FacetedSearchRequest,NameUsageSuggestRequest
public abstract class BaseSearchRequest<P extends SearchParameter>
extends PageableBase
implements SearchRequest<P>
Generic request class for search operations. This class contains a list of parameters, a list of
desired facets and paging options (page size and offset).
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gbif.api.model.common.paging.Pageable
Pageable.OffsetLimitParametersNested classes/interfaces inherited from interface org.gbif.api.model.common.search.SearchRequest
SearchRequest.QueryField -
Constructor Summary
ConstructorsConstructorDescriptionConstructor with default paging offset & limit.BaseSearchRequest(long offset, int limit) Minimal paging constructor.BaseSearchRequest(String query) Simple query constructor with default paging offset & limit.BaseSearchRequest(Pageable page) Minimal paging constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameter(P parameter, boolean value) Adds the specified boolean parameter.voidaddParameter(P parameter, double value) Adds the specified double parameter.voidaddParameter(P parameter, int value) Adds the specified int parameter.voidaddParameter(P parameter, long value) Adds the specified long parameter.voidaddParameter(P parameter, Enum<?> value) Adds the specified parameter.voidaddParameter(P parameter, Iterable<String> values) Adds the specified parameter.voidaddParameter(P parameter, String value) Adds the specified parameter.voidaddParameter(P parameter, String... values) Adds the specified parameter.voidaddParameter(P parameter, Date value) Adds the specified date parameter as an ISO date.voidaddParameter(P parameter, IsoDateInterval value) Adds the specified date parameter as an ISO date interval.voidcopyPagingValues(Pageable pageable) Utility method to copy paging values.Defines the fields to be highlighted if highlighting is activated.List of input parameters of the search operation.getQ()Query parameter.Defines whether to match against fields with scientific or vernacular names or both.intbooleanThis flag enables the use of case-sensitive matches and aggregations on certain search parameters.booleanvoidsetHighlight(boolean highlight) voidsetHighlightFields(Set<SearchRequest.QueryField> highlightFields) voidsetParameters(Map<P, Set<String>> parameters) Sets the list of parameters.voidvoidsetQFields(Set<SearchRequest.QueryField> qFields) voidsetSpellCheck(boolean spellCheck) voidsetSpellCheckCount(int spellCheckCount) toString()
-
Constructor Details
-
BaseSearchRequest
public BaseSearchRequest()Constructor with default paging offset & limit. -
BaseSearchRequest
Simple query constructor with default paging offset & limit.- Parameters:
query- string for request
-
BaseSearchRequest
Minimal paging constructor. -
BaseSearchRequest
Minimal paging constructor.
-
-
Method Details
-
isMatchCase
This flag enables the use of case-sensitive matches and aggregations on certain search parameters.Fields that support this feature are: occurrenceId, recordedBy, samplingProtocol, catalogNumber, collectionCode, institutionCode, eventId, parentEventId, waterBody, stateProvince, recordNumber, identifiedBy, organismId and locality.
This is an experimental feature, and its implementation may change or be removed at any time.
Be aware that this is not a per-field flag, all possible fields will match case sensitively.
- Specified by:
isMatchCasein interfaceSearchRequest<P extends SearchParameter>
-
isHighlight
- Specified by:
isHighlightin interfaceSearchRequest<P extends SearchParameter>- Returns:
- true if highlighted search matches are requested
-
setHighlight
- Specified by:
setHighlightin interfaceSearchRequest<P extends SearchParameter>- Parameters:
highlight- the highlight to set
-
isSpellCheck
- Specified by:
isSpellCheckin interfaceSearchRequest<P extends SearchParameter>- Returns:
- true if spellCheck search is requested
-
setSpellCheck
- Specified by:
setSpellCheckin interfaceSearchRequest<P extends SearchParameter>- Parameters:
spellCheck- the highlight to set
-
getSpellCheckCount
- Specified by:
getSpellCheckCountin interfaceSearchRequest<P extends SearchParameter>- Returns:
- max number of spell check suggestions requested
-
setSpellCheckCount
- Specified by:
setSpellCheckCountin interfaceSearchRequest<P extends SearchParameter>- Parameters:
spellCheckCount- number of spell check suggestions
-
getQFields
Defines whether to match against fields with scientific or vernacular names or both.- Specified by:
getQFieldsin interfaceSearchRequest<P extends SearchParameter>
-
setQFields
- Specified by:
setQFieldsin interfaceSearchRequest<P extends SearchParameter>
-
getHighlightFields
Defines the fields to be highlighted if highlighting is activated.- Specified by:
getHighlightFieldsin interfaceSearchRequest<P extends SearchParameter>
-
setHighlightFields
- Specified by:
setHighlightFieldsin interfaceSearchRequest<P extends SearchParameter>
-
getParameters
List of input parameters of the search operation. The parameters are handled as the parameter name and the string representation of its value.- Specified by:
getParametersin interfaceSearchRequest<P extends SearchParameter>- Returns:
- the list of parameters
-
setParameters
Sets the list of parameters.- Specified by:
setParametersin interfaceSearchRequest<P extends SearchParameter>
-
getQ
Query parameter.- Specified by:
getQin interfaceSearchRequest<P extends SearchParameter>- Returns:
- the q
-
setQ
- Specified by:
setQin interfaceSearchRequest<P extends SearchParameter>- Parameters:
q- the q to set
-
addParameter
Adds the specified parameter.- Specified by:
addParameterin interfaceSearchRequest<P extends SearchParameter>- Parameters:
parameter- parameter to add values forvalues- list of values of the parameter to add
-
addParameter
Adds the specified parameter.- Specified by:
addParameterin interfaceSearchRequest<P extends SearchParameter>- Parameters:
parameter- parameter to add values forvalues- list of values of the parameter to add
-
addParameter
Adds the specified parameter.- Specified by:
addParameterin interfaceSearchRequest<P extends SearchParameter>- Parameters:
parameter- parameter to add values forvalue- value of the parameter to add
-
addParameter
Adds the specified long parameter.- Specified by:
addParameterin interfaceSearchRequest<P extends SearchParameter>- Parameters:
parameter- parameter to add values forvalue- value of the parameter to add
-
addParameter
Adds the specified int parameter.- Specified by:
addParameterin interfaceSearchRequest<P extends SearchParameter>- Parameters:
parameter- parameter to add values forvalue- value of the parameter to add
-
addParameter
Adds the specified double parameter.- Specified by:
addParameterin interfaceSearchRequest<P extends SearchParameter>- Parameters:
parameter- parameter to add values forvalue- value of the parameter to add
-
addParameter
Adds the specified boolean parameter.- Specified by:
addParameterin interfaceSearchRequest<P extends SearchParameter>- Parameters:
parameter- parameter to add values forvalue- value of the parameter to add
-
addParameter
Adds the specified parameter.- Specified by:
addParameterin interfaceSearchRequest<P extends SearchParameter>- Parameters:
parameter- parameter to add values forvalue- enum value of the parameter to add
-
addParameter
Adds the specified date parameter as an ISO date.- Specified by:
addParameterin interfaceSearchRequest<P extends SearchParameter>- Parameters:
parameter- parameter to add date forvalue- date value of the parameter to add
-
addParameter
Adds the specified date parameter as an ISO date interval.- Specified by:
addParameterin interfaceSearchRequest<P extends SearchParameter>- Parameters:
parameter- parameter to add date interval forvalue- date value of the parameter to add
-
copyPagingValues
Description copied from class:PageableBaseUtility method to copy paging values.- Specified by:
copyPagingValuesin interfaceSearchRequest<P extends SearchParameter>- Overrides:
copyPagingValuesin classPageableBase
-
toString
- Overrides:
toStringin classPageableBase
-