Class SearchResponse
- java.lang.Object
-
- org.springframework.data.domain.PageImpl<Object>
-
- com.broadleafcommerce.search.api.domain.SearchResponse
-
- All Implemented Interfaces:
Serializable
,Iterable<Object>
,Supplier<Stream<Object>>
,org.springframework.data.domain.Page<Object>
,org.springframework.data.domain.Slice<Object>
,org.springframework.data.util.Streamable<Object>
public class SearchResponse extends org.springframework.data.domain.PageImpl<Object>
Represents the results from a search.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SearchResponse(List<Object> content, org.springframework.data.domain.Pageable pageable, long total)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
List<T>
getContent()
protected <U extends Object>
List<U>getConvertedContent(Function<? super T,? extends U> arg0)
List<FacetResponse>
getFacets()
The facets returned in the search result.int
getNumber()
int
getNumberOfElements()
org.springframework.data.domain.Pageable
getPageable()
SearchRedirectResponse
getRedirect()
A redirect generated based on the original request query.int
getSize()
org.springframework.data.domain.Sort
getSort()
List<SortResponse>
getSorts()
The sort options returned in the search result.SpellCheckResult
getSpellCheckResult()
Set if spellcheck returned any results.boolean
hasContent()
int
hashCode()
boolean
hasPrevious()
boolean
isCorrectedQuery()
If no results were found and a different query was executed than the original, this is set to true.boolean
isFirst()
Iterator<T>
iterator()
org.springframework.data.domain.Pageable
nextPageable()
org.springframework.data.domain.Pageable
previousPageable()
void
setCorrectedQuery(boolean correctedQuery)
If no results were found and a different query was executed than the original, this is set to true.void
setFacets(List<FacetResponse> facets)
The facets returned in the search result.void
setRedirect(SearchRedirectResponse redirect)
A redirect generated based on the original request query.void
setSorts(List<SortResponse> sorts)
The sort options returned in the search result.void
setSpellCheckResult(SpellCheckResult spellCheckResult)
Set if spellcheck returned any results.String
toString()
-
Methods inherited from class org.springframework.data.domain.PageImpl
getTotalElements, getTotalPages, hasNext, isLast, map
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
getFacets
public List<FacetResponse> getFacets()
The facets returned in the search result.- Returns:
- facets returned in the search result
-
getSorts
public List<SortResponse> getSorts()
The sort options returned in the search result.- Returns:
- sort options returned in the search result
-
getRedirect
public SearchRedirectResponse getRedirect()
A redirect generated based on the original request query.If present, the rest of the response will be empty.
- Returns:
- redirect to perform in place of search results
-
isCorrectedQuery
public boolean isCorrectedQuery()
If no results were found and a different query was executed than the original, this is set to true.- Returns:
- whether this response is for a different corrected query
-
getSpellCheckResult
public SpellCheckResult getSpellCheckResult()
Set if spellcheck returned any results. Contains the original query and any potential suggestions.- Returns:
- spell check results and suggestions
-
setFacets
public void setFacets(List<FacetResponse> facets)
The facets returned in the search result.- Parameters:
facets
- facets returned in the search result
-
setSorts
public void setSorts(List<SortResponse> sorts)
The sort options returned in the search result.- Parameters:
sorts
- sort options returned in the search result
-
setRedirect
public void setRedirect(SearchRedirectResponse redirect)
A redirect generated based on the original request query.If present, the rest of the response will be empty.
- Parameters:
redirect
- redirect to perform in place of search results
-
setCorrectedQuery
public void setCorrectedQuery(boolean correctedQuery)
If no results were found and a different query was executed than the original, this is set to true.- Parameters:
correctedQuery
- whether this response is for a different corrected query
-
setSpellCheckResult
public void setSpellCheckResult(SpellCheckResult spellCheckResult)
Set if spellcheck returned any results. Contains the original query and any potential suggestions.- Parameters:
spellCheckResult
- spell check results and suggestions
-
toString
public String toString()
- Overrides:
toString
in classorg.springframework.data.domain.PageImpl<Object>
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classorg.springframework.data.domain.PageImpl<Object>
-
canEqual
protected boolean canEqual(Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classorg.springframework.data.domain.PageImpl<Object>
-
getNumber
public int getNumber()
- Specified by:
getNumber
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
getSize
public int getSize()
- Specified by:
getSize
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
getNumberOfElements
public int getNumberOfElements()
- Specified by:
getNumberOfElements
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
hasPrevious
public boolean hasPrevious()
- Specified by:
hasPrevious
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
isFirst
public boolean isFirst()
- Specified by:
isFirst
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
nextPageable
public org.springframework.data.domain.Pageable nextPageable()
- Specified by:
nextPageable
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
previousPageable
public org.springframework.data.domain.Pageable previousPageable()
- Specified by:
previousPageable
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
hasContent
public boolean hasContent()
- Specified by:
hasContent
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
getContent
public List<T> getContent()
- Specified by:
getContent
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
getPageable
public org.springframework.data.domain.Pageable getPageable()
- Specified by:
getPageable
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
getSort
public org.springframework.data.domain.Sort getSort()
- Specified by:
getSort
in interfaceorg.springframework.data.domain.Slice<T extends Object>
-
iterator
public Iterator<T> iterator()
-
-