Class SolrSearchResult
- java.lang.Object
-
- de.hybris.platform.solrfacetsearch.search.impl.SolrSearchResult
-
- All Implemented Interfaces:
SearchResult,java.io.Serializable
public class SolrSearchResult extends java.lang.Object implements SearchResult, java.io.Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SolrSearchResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFacet(Facet facet)booleancontainsFacet(java.lang.String name)Checks if the specified name is a facet.java.util.Map<java.lang.String,java.lang.Object>getAttributes()Returns attributes for the current search result.java.util.List<IndexedTypeSort>getAvailableNamedSorts()Return list of available named sorts.java.util.List<Breadcrumb>getBreadcrumbs()Return bread-crumbs for the current search result state.protected ConvertergetConverter(ConverterType converterType)ConvertersMappinggetConvertersMapping()IndexedTypeSortgetCurrentNamedSort()Return currently selected sort.java.util.List<Document>getDocuments()Returns the document that represent the main results.FacetgetFacet(java.lang.String name)Searches for the root of a facet tree which contains the Facet and all FacetValues, for example, manufacturers(Facet) contains [eizo, ati, ..](FacetValue)java.util.Set<java.lang.String>getFacetNames()Searches for all root facet names.java.util.List<Facet>getFacets()Searches for all available facets which contain the whole tree, manufacturers [eizo, ati, ..], prices [100-499,500-999],categories [online, staged]FacetSearchConfiggetFacetSearchConfig()java.util.Map<java.lang.String,Facet>getFacetsMap()java.util.List<SearchResultGroupCommand>getGroupCommands()Returns the group results.java.util.List<java.lang.String>getIdentifiers()Searches for the identifiers saved in the index, for example, "sony_online", "ati_staged", or "just_name"IndexedTypegetIndexedType()java.util.List<KeywordRedirectValue>getKeywordRedirects()protected ModelLoadergetModelLoader(IndexedType indexType)longgetNumberOfPages()Use for paginationlonggetNumberOfResults()Returns the number of results.intgetOffset()Use for paginationintgetPageSize()Use for paginationSearchQueryInfogetQueryInfo()Statistics Info about the Search Query - usable for loggingorg.apache.solr.client.solrj.response.QueryResponsegetQueryResponse()java.util.List<java.lang.String>getResultCodes()Searches for item's codes.<T> java.util.List<T>getResultData(ConverterType converterType)Returns SOLR results in form of a simple data objects (DTO's)java.util.List<PK>getResultPKs()Searches for all result PKs.java.util.List<? extends ItemModel>getResults()Searches for all result items.SearchQuerygetSearchQuery()java.util.List<org.apache.solr.common.SolrDocument>getSolrDocuments()org.apache.solr.client.solrj.response.QueryResponsegetSolrObject()Searches for the underlying implementation.java.lang.StringgetSpellingSuggestion()Get the best suggestion from the spellchecker.booleanhasNext()Use for paginationbooleanhasPrevious()Use for paginationvoidsetAvailableNamedSorts(java.util.List<IndexedTypeSort> availableNamedSorts)voidsetBreadcrumbs(java.util.List<Breadcrumb> breadcrumbs)voidsetConvertersMapping(ConvertersMapping convertersMapping)voidsetCurrentNamedSort(IndexedTypeSort currentNamedSort)voidsetDocuments(java.util.List<Document> documents)voidsetFacetsMap(java.util.Map<java.lang.String,Facet> facets)voidsetGroupCommands(java.util.List<SearchResultGroupCommand> groupCommands)voidsetKeywordRedirects(java.util.List<KeywordRedirectValue> keywordRedirects)voidsetNumberOfResults(long numberOfResults)voidsetQueryResponse(org.apache.solr.client.solrj.response.QueryResponse queryResponse)voidsetSearchQuery(SearchQuery searchQuery)voidsetSolrDocuments(java.util.List<org.apache.solr.common.SolrDocument> solrDocuments)
-
-
-
Method Detail
-
getConvertersMapping
public ConvertersMapping getConvertersMapping()
-
setConvertersMapping
public void setConvertersMapping(ConvertersMapping convertersMapping)
-
getSearchQuery
public SearchQuery getSearchQuery()
-
setSearchQuery
public void setSearchQuery(SearchQuery searchQuery)
-
getQueryResponse
public org.apache.solr.client.solrj.response.QueryResponse getQueryResponse()
-
setQueryResponse
public void setQueryResponse(org.apache.solr.client.solrj.response.QueryResponse queryResponse)
-
getNumberOfResults
public long getNumberOfResults()
Description copied from interface:SearchResultReturns the number of results. If result grouping is being used, this is the number of groups.- Specified by:
getNumberOfResultsin interfaceSearchResult- Returns:
- the number of results
-
setNumberOfResults
public void setNumberOfResults(long numberOfResults)
-
getDocuments
public java.util.List<Document> getDocuments()
Description copied from interface:SearchResultReturns the document that represent the main results.- Specified by:
getDocumentsin interfaceSearchResult- Returns:
- the documents
-
setDocuments
public void setDocuments(java.util.List<Document> documents)
-
getSolrDocuments
public java.util.List<org.apache.solr.common.SolrDocument> getSolrDocuments()
-
setSolrDocuments
public void setSolrDocuments(java.util.List<org.apache.solr.common.SolrDocument> solrDocuments)
-
getGroupCommands
public java.util.List<SearchResultGroupCommand> getGroupCommands()
Description copied from interface:SearchResultReturns the group results.- Specified by:
getGroupCommandsin interfaceSearchResult- Returns:
- the group results
-
setGroupCommands
public void setGroupCommands(java.util.List<SearchResultGroupCommand> groupCommands)
-
getFacetsMap
public java.util.Map<java.lang.String,Facet> getFacetsMap()
-
setFacetsMap
public void setFacetsMap(java.util.Map<java.lang.String,Facet> facets)
-
getBreadcrumbs
public java.util.List<Breadcrumb> getBreadcrumbs()
Description copied from interface:SearchResultReturn bread-crumbs for the current search result state.- Specified by:
getBreadcrumbsin interfaceSearchResult- Returns:
- List of
Breadcrumb
-
setBreadcrumbs
public void setBreadcrumbs(java.util.List<Breadcrumb> breadcrumbs)
-
getKeywordRedirects
public java.util.List<KeywordRedirectValue> getKeywordRedirects()
- Specified by:
getKeywordRedirectsin interfaceSearchResult
-
getAvailableNamedSorts
public java.util.List<IndexedTypeSort> getAvailableNamedSorts()
Description copied from interface:SearchResultReturn list of available named sorts.- Specified by:
getAvailableNamedSortsin interfaceSearchResult- Returns:
- List of
IndexedTypeSort
-
setAvailableNamedSorts
public void setAvailableNamedSorts(java.util.List<IndexedTypeSort> availableNamedSorts)
-
getCurrentNamedSort
public IndexedTypeSort getCurrentNamedSort()
Description copied from interface:SearchResultReturn currently selected sort.- Specified by:
getCurrentNamedSortin interfaceSearchResult- Returns:
- current sort
-
setCurrentNamedSort
public void setCurrentNamedSort(IndexedTypeSort currentNamedSort)
-
setKeywordRedirects
public void setKeywordRedirects(java.util.List<KeywordRedirectValue> keywordRedirects)
-
getFacetSearchConfig
public FacetSearchConfig getFacetSearchConfig()
-
getIndexedType
public IndexedType getIndexedType()
-
getOffset
public int getOffset()
Description copied from interface:SearchResultUse for pagination- Specified by:
getOffsetin interfaceSearchResult- Returns:
- the offset of the pages, 0 for the first page, 1 for the second, and so on
-
getPageSize
public int getPageSize()
Description copied from interface:SearchResultUse for pagination- Specified by:
getPageSizein interfaceSearchResult- Returns:
- size of the page
-
hasNext
public boolean hasNext()
Description copied from interface:SearchResultUse for pagination- Specified by:
hasNextin interfaceSearchResult- Returns:
- true if the next page is available, false otherwise.
-
hasPrevious
public boolean hasPrevious()
Description copied from interface:SearchResultUse for pagination- Specified by:
hasPreviousin interfaceSearchResult- Returns:
- true if the previous page is available, false otherwise.
-
getNumberOfPages
public long getNumberOfPages()
Description copied from interface:SearchResultUse for pagination- Specified by:
getNumberOfPagesin interfaceSearchResult- Returns:
- number of pages
-
getIdentifiers
public java.util.List<java.lang.String> getIdentifiers()
Description copied from interface:SearchResultSearches for the identifiers saved in the index, for example, "sony_online", "ati_staged", or "just_name"- Specified by:
getIdentifiersin interfaceSearchResult- Returns:
- collection of all identifiers
-
getResultPKs
public java.util.List<PK> getResultPKs() throws FacetSearchException
Description copied from interface:SearchResultSearches for all result PKs.- Specified by:
getResultPKsin interfaceSearchResult- Returns:
- resulting items PK
- Throws:
FacetSearchException
-
getResultCodes
public java.util.List<java.lang.String> getResultCodes() throws FacetSearchExceptionDescription copied from interface:SearchResultSearches for item's codes.- Specified by:
getResultCodesin interfaceSearchResult- Returns:
- List items codes as Strings
- Throws:
FacetSearchException
-
getResults
public java.util.List<? extends ItemModel> getResults() throws FacetSearchException
Description copied from interface:SearchResultSearches for all result items. Example, [product_01, product_02], or [cms_01, cms_02, cms_03]- Specified by:
getResultsin interfaceSearchResult- Returns:
- all items
- Throws:
FacetSearchException
-
getResultData
public <T> java.util.List<T> getResultData(ConverterType converterType)
Description copied from interface:SearchResultReturns SOLR results in form of a simple data objects (DTO's)- Specified by:
getResultDatain interfaceSearchResult- Returns:
- unmodifiable, lazy list of search result DTO's
- Throws:
java.lang.IllegalStateException- when no converter was registered for result type or query was not passed in the constructor
-
addFacet
public void addFacet(Facet facet)
-
getFacetNames
public java.util.Set<java.lang.String> getFacetNames()
Description copied from interface:SearchResultSearches for all root facet names. Example: [manufacturers, prices, categories]- Specified by:
getFacetNamesin interfaceSearchResult- Returns:
- all root facet names
-
containsFacet
public boolean containsFacet(java.lang.String name)
Description copied from interface:SearchResultChecks if the specified name is a facet. For example, manufacturers --> true, admin --> false- Specified by:
containsFacetin interfaceSearchResult- Parameters:
name- name of the root facet- Returns:
- true if found, false otherwise
-
getFacet
public Facet getFacet(java.lang.String name)
Description copied from interface:SearchResultSearches for the root of a facet tree which contains the Facet and all FacetValues, for example, manufacturers(Facet) contains [eizo, ati, ..](FacetValue)- Specified by:
getFacetin interfaceSearchResult- Parameters:
name- name of the facet- Returns:
- found facet or null when facet with given name is not available
-
getFacets
public java.util.List<Facet> getFacets()
Description copied from interface:SearchResultSearches for all available facets which contain the whole tree, manufacturers [eizo, ati, ..], prices [100-499,500-999],categories [online, staged]- Specified by:
getFacetsin interfaceSearchResult- Returns:
- all available facets
-
getSpellingSuggestion
public java.lang.String getSpellingSuggestion()
Description copied from interface:SearchResultGet the best suggestion from the spellchecker. Returns null if spell checker is not enabled, or no better suggestion than the user's query is found. Requires the UserQuery to be set on the SearchQuery.- Specified by:
getSpellingSuggestionin interfaceSearchResult
-
getQueryInfo
public SearchQueryInfo getQueryInfo()
Description copied from interface:SearchResultStatistics Info about the Search Query - usable for logging- Specified by:
getQueryInfoin interfaceSearchResult
-
getSolrObject
public org.apache.solr.client.solrj.response.QueryResponse getSolrObject()
Description copied from interface:SearchResultSearches for the underlying implementation.- Specified by:
getSolrObjectin interfaceSearchResult- Returns:
- The result object of the underlying implementation.
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Description copied from interface:SearchResultReturns attributes for the current search result.- Specified by:
getAttributesin interfaceSearchResult- Returns:
- the attributes
-
getConverter
protected Converter getConverter(ConverterType converterType)
-
getModelLoader
protected ModelLoader getModelLoader(IndexedType indexType)
-
-