Class SearchRedirectMatchService
- java.lang.Object
-
- com.broadleafcommerce.search.core.service.SearchRedirectMatchService
-
public class SearchRedirectMatchService extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
CACHE_BY_SEARCH_REQUEST
protected SearchRedirectService<com.broadleafcommerce.search.api.domain.SearchRedirect>
searchRedirectService
-
Constructor Summary
Constructors Constructor Description SearchRedirectMatchService(SearchRedirectService<com.broadleafcommerce.search.api.domain.SearchRedirect> searchRedirectService, com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<com.broadleafcommerce.search.api.domain.SearchRedirect>
findRedirect(com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Try to findSearchRedirect
based on exact query match, or regex query match.protected Optional<com.broadleafcommerce.search.api.domain.SearchRedirect>
getRedirectByRegexMatch(String query, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected Map<Pattern,com.broadleafcommerce.search.api.domain.SearchRedirect>
getRegexSearchRedirectMap(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Returns a map, with apattern
as the key, and theSearchRedirect
for that pattern as the value.
-
-
-
Field Detail
-
CACHE_BY_SEARCH_REQUEST
public static final String CACHE_BY_SEARCH_REQUEST
- See Also:
- Constant Field Values
-
searchRedirectService
protected final SearchRedirectService<com.broadleafcommerce.search.api.domain.SearchRedirect> searchRedirectService
-
-
Constructor Detail
-
SearchRedirectMatchService
public SearchRedirectMatchService(SearchRedirectService<com.broadleafcommerce.search.api.domain.SearchRedirect> searchRedirectService, com.broadleafcommerce.common.extension.cache.CacheStateManager cacheStateManager)
-
-
Method Detail
-
findRedirect
public Optional<com.broadleafcommerce.search.api.domain.SearchRedirect> findRedirect(com.broadleafcommerce.search.api.domain.SearchRequest searchRequest, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Try to findSearchRedirect
based on exact query match, or regex query match.- Parameters:
searchRequest
- the search to find a redirect forcontextInfo
- The context information surrounding sandboxing/multitenant state- Returns:
- the search redirect for the search request
-
getRedirectByRegexMatch
protected Optional<com.broadleafcommerce.search.api.domain.SearchRedirect> getRedirectByRegexMatch(@Nullable String query, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
getRegexSearchRedirectMap
protected Map<Pattern,com.broadleafcommerce.search.api.domain.SearchRedirect> getRegexSearchRedirectMap(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Returns a map, with apattern
as the key, and theSearchRedirect
for that pattern as the value. Provides caching mechanism for re-using compiled patterns when handling search redirects.- Parameters:
contextInfo
-- Returns:
-
-