Package org.gbif.api.model.common.search
Class SearchRequest<P extends SearchParameter>
- java.lang.Object
-
- org.gbif.api.model.common.paging.PageableBase
-
- org.gbif.api.model.common.search.SearchRequest<P>
-
- All Implemented Interfaces:
Pageable
- Direct Known Subclasses:
DatasetSuggestRequest,FacetedSearchRequest,NameUsageSuggestRequest
public class SearchRequest<P extends SearchParameter> extends PageableBase
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 Modifier and Type Class Description static interfaceSearchRequest.QueryField-
Nested classes/interfaces inherited from interface org.gbif.api.model.common.paging.Pageable
Pageable.OffsetLimitParameters
-
-
Constructor Summary
Constructors Constructor Description SearchRequest()Constructor with default paging offset & limit.SearchRequest(long offset, int limit)Minimal paging constructor.SearchRequest(String query)Simple query constructor with default paging offset & limit.SearchRequest(Pageable page)Minimal paging constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddParameter(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.Set<SearchRequest.QueryField>getHighlightFields()Defines the fields to be highlighted if highlighting is activated.Map<P,Set<String>>getParameters()List of input parameters of the search operation.StringgetQ()Query parameter.Set<SearchRequest.QueryField>getQFields()Defines whether to match against fields with scientific or vernacular names or both.intgetSpellCheckCount()booleanisHighlight()booleanisSpellCheck()voidsetHighlight(boolean highlight)voidsetHighlightFields(Set<SearchRequest.QueryField> highlightFields)voidsetParameters(Map<P,Set<String>> parameters)Sets the list of parameters.voidsetQ(String q)voidsetQFields(Set<SearchRequest.QueryField> qFields)voidsetSpellCheck(boolean spellCheck)voidsetSpellCheckCount(int spellCheckCount)StringtoString()-
Methods inherited from class org.gbif.api.model.common.paging.PageableBase
addOffset, copyPagingValues, equals, getLimit, getOffset, hashCode, setLimit, setOffset
-
-
-
-
Constructor Detail
-
SearchRequest
public SearchRequest()
Constructor with default paging offset & limit.
-
SearchRequest
public SearchRequest(String query)
Simple query constructor with default paging offset & limit.- Parameters:
query- string for request
-
SearchRequest
public SearchRequest(Pageable page)
Minimal paging constructor.
-
SearchRequest
public SearchRequest(long offset, int limit)
Minimal paging constructor.
-
-
Method Detail
-
isHighlight
public boolean isHighlight()
- Returns:
- true if highlighted search matches are requested
-
setHighlight
public void setHighlight(boolean highlight)
- Parameters:
highlight- the highlight to set
-
isSpellCheck
public boolean isSpellCheck()
- Returns:
- true if spellCheck search is requested
-
setSpellCheck
public void setSpellCheck(boolean spellCheck)
- Parameters:
spellCheck- the highlight to set
-
getSpellCheckCount
public int getSpellCheckCount()
- Returns:
- max number of spell check suggestions requested
-
setSpellCheckCount
public void setSpellCheckCount(int spellCheckCount)
- Parameters:
spellCheckCount- number of spell check suggestions
-
getQFields
public Set<SearchRequest.QueryField> getQFields()
Defines whether to match against fields with scientific or vernacular names or both.
-
setQFields
public void setQFields(Set<SearchRequest.QueryField> qFields)
-
getHighlightFields
public Set<SearchRequest.QueryField> getHighlightFields()
Defines the fields to be highlighted if highlighting is activated.
-
setHighlightFields
public void setHighlightFields(Set<SearchRequest.QueryField> highlightFields)
-
getParameters
public Map<P,Set<String>> getParameters()
List of input parameters of the search operation. The parameters are handled as the parameter name and the string representation of its value.- Returns:
- the list of parameters
-
setParameters
public void setParameters(Map<P,Set<String>> parameters)
Sets the list of parameters.
-
addParameter
public void addParameter(P parameter, Iterable<String> values)
Adds the specified parameter.- Parameters:
parameter- parameter to add values forvalues- list of values of the parameter to add
-
addParameter
public void addParameter(P parameter, String... values)
Adds the specified parameter.- Parameters:
parameter- parameter to add values forvalues- list of values of the parameter to add
-
addParameter
public void addParameter(P parameter, String value)
Adds the specified parameter.- Parameters:
parameter- parameter to add values forvalue- value of the parameter to add
-
addParameter
public void addParameter(P parameter, long value)
Adds the specified long parameter.- Parameters:
parameter- parameter to add values forvalue- value of the parameter to add
-
addParameter
public void addParameter(P parameter, int value)
Adds the specified int parameter.- Parameters:
parameter- parameter to add values forvalue- value of the parameter to add
-
addParameter
public void addParameter(P parameter, double value)
Adds the specified double parameter.- Parameters:
parameter- parameter to add values forvalue- value of the parameter to add
-
addParameter
public void addParameter(P parameter, boolean value)
Adds the specified boolean parameter.- Parameters:
parameter- parameter to add values forvalue- value of the parameter to add
-
addParameter
public void addParameter(P parameter, Enum<?> value)
Adds the specified parameter.- Parameters:
parameter- parameter to add values forvalue- enum value of the parameter to add
-
addParameter
public void addParameter(P parameter, Date value)
Adds the specified date parameter as an ISO date.- Parameters:
parameter- parameter to add date forvalue- date value of the parameter to add
-
addParameter
public void addParameter(P parameter, IsoDateInterval value)
Adds the specified date parameter as an ISO date interval.- Parameters:
parameter- parameter to add date interval forvalue- date value of the parameter to add
-
toString
public String toString()
- Overrides:
toStringin classPageableBase
-
-