Class SearchOptionsImpl
- java.lang.Object
-
- com.adobe.cq.commerce.core.search.internal.models.SearchOptionsImpl
-
- All Implemented Interfaces:
SearchOptions
public class SearchOptionsImpl extends Object implements SearchOptions
-
-
Field Summary
Fields Modifier and Type Field Description static String
CATEGORY_ID_PARAMETER_ID
static String
CATEGORY_UID_PARAMETER_ID
static String
CURRENT_PAGE_PARAMETER_ID
static Integer
PAGE_SIZE_DEFAULT
static String
SEARCH_QUERY_PARAMETER_ID
-
Constructor Summary
Constructors Constructor Description SearchOptionsImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSorterKey(String name, String label, Sorter.Order preferredOrder)
Add a possible sorter key to this search options.Map<String,String>
getAllFilters()
Retrieves all filters, including the category id which is being treated as a special case as a developer convenience.Map<String,String>
getAttributeFilters()
Optional<String>
getCategoryId()
Optional<String>
getCategoryUid()
int
getCurrentPage()
int
getPageSize()
Optional<String>
getSearchQuery()
List<SorterKey>
getSorterKeys()
void
setAttributeFilters(Map<String,String> attributeFilters)
void
setCategoryId(String categoryId)
void
setCategoryUid(String categoryUid)
void
setCurrentPage(Integer currentPage)
void
setPageSize(Integer pageSize)
void
setSearchQuery(String searchQuery)
-
-
-
Field Detail
-
PAGE_SIZE_DEFAULT
public static final Integer PAGE_SIZE_DEFAULT
-
CATEGORY_ID_PARAMETER_ID
public static final String CATEGORY_ID_PARAMETER_ID
- See Also:
- Constant Field Values
-
CATEGORY_UID_PARAMETER_ID
public static final String CATEGORY_UID_PARAMETER_ID
- See Also:
- Constant Field Values
-
SEARCH_QUERY_PARAMETER_ID
public static final String SEARCH_QUERY_PARAMETER_ID
- See Also:
- Constant Field Values
-
CURRENT_PAGE_PARAMETER_ID
public static final String CURRENT_PAGE_PARAMETER_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAllFilters
public Map<String,String> getAllFilters()
Description copied from interface:SearchOptions
Retrieves all filters, including the category id which is being treated as a special case as a developer convenience. This method essentially returns all of the attribute filters but also includes the category id if it was set.- Specified by:
getAllFilters
in interfaceSearchOptions
- Returns:
- a key value pair of the attribute codes or identifiers with the chosen value
-
getAttributeFilters
public Map<String,String> getAttributeFilters()
- Specified by:
getAttributeFilters
in interfaceSearchOptions
-
setCategoryId
public void setCategoryId(String categoryId)
-
setCategoryUid
public void setCategoryUid(String categoryUid)
-
getSearchQuery
public Optional<String> getSearchQuery()
- Specified by:
getSearchQuery
in interfaceSearchOptions
-
setSearchQuery
public void setSearchQuery(String searchQuery)
-
getCurrentPage
public int getCurrentPage()
- Specified by:
getCurrentPage
in interfaceSearchOptions
-
setCurrentPage
public void setCurrentPage(Integer currentPage)
-
getPageSize
public int getPageSize()
- Specified by:
getPageSize
in interfaceSearchOptions
-
setPageSize
public void setPageSize(Integer pageSize)
-
addSorterKey
public void addSorterKey(String name, String label, Sorter.Order preferredOrder)
Description copied from interface:SearchOptions
Add a possible sorter key to this search options. Sorter keys are displayed in the UI in the order of addition. The first sorter key is considered to be the default. The preferred sort order for a sort key is used in favor or the current sort order when the sort key is selected for sorting.- Specified by:
addSorterKey
in interfaceSearchOptions
- Parameters:
name
- the nonempty sort key namelabel
- the nonempty sort key labelpreferredOrder
- preferred ordering for this sort key or null if not specified
-
getSorterKeys
public List<SorterKey> getSorterKeys()
- Specified by:
getSorterKeys
in interfaceSearchOptions
- Returns:
- The configured sort keys. The first key is the default used for the initial sorting of search results.
-
-