Class DefaultSolrCollectionResolver
- java.lang.Object
-
- com.broadleafcommerce.search.provider.solr.DefaultSolrCollectionResolver
-
- All Implemented Interfaces:
SolrCollectionResolver
public class DefaultSolrCollectionResolver extends Object implements SolrCollectionResolver
Default implementation of theSolrCollectionResolver. This assumes that the Solr alias names are stored as properties with the following format:broadleaf.search.{type}.primaryAlias=some_primary_alias
or
broadleaf.search.{type}.secondaryAlias=some_secondary_alias
For example:
broadleaf.search.catalog.primaryAlias=catalog_primary
Note that the values returned here could be Solr collection names, but are typically Solr aliases. Primary aliases are the aliases assigned to the foreground, primary Solr collection. Secondary alias names are meant for background collections that are typically used to do a full reindex, where the data is deleted and then reloaded. Then the collections are re-aliased, making the newly loaded collection the primary, and the previous collection the background, ready to be deleted and reloaded.
- Author:
- Kelly Tisdell (ktisdell)
-
-
Field Summary
Fields Modifier and Type Field Description static StringALIAS_PROPERTY_PREFIXstatic StringPRIMARY_ALIAS_PROPERTY_SUFFIXstatic StringSECONDARY_ALIAS_PROPERTY_SUFFIX
-
Constructor Summary
Constructors Constructor Description DefaultSolrCollectionResolver(@NonNull org.springframework.core.env.Environment environment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetPrimarySolrCollectionForIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable)Retrieve the correct primary (foreground) Solr alias name for the givenIndexable.StringgetPrimarySolrCollectionForType(com.broadleafcommerce.search.api.type.IndexableType type)Retrieve the correct primary (foreground) Solr alias name for the givenIndexableType.StringgetPrimarySolrCollectionForType(String type)Retrieve the correct primary (foreground) Solr alias name for the given type.StringgetSecondarySolrCollectionForIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable)Retrieve the correct secondary (background) Solr alias name for the givenIndexable.StringgetSecondarySolrCollectionForType(com.broadleafcommerce.search.api.type.IndexableType type)Retrieve the correct secondary (background) Solr alias name for the givenIndexableType.StringgetSecondarySolrCollectionForType(String type)Retrieve the correct secondary (background) Solr alias name for the given type.
-
-
-
Field Detail
-
ALIAS_PROPERTY_PREFIX
public static final String ALIAS_PROPERTY_PREFIX
- See Also:
- Constant Field Values
-
PRIMARY_ALIAS_PROPERTY_SUFFIX
public static final String PRIMARY_ALIAS_PROPERTY_SUFFIX
- See Also:
- Constant Field Values
-
SECONDARY_ALIAS_PROPERTY_SUFFIX
public static final String SECONDARY_ALIAS_PROPERTY_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getPrimarySolrCollectionForType
public String getPrimarySolrCollectionForType(com.broadleafcommerce.search.api.type.IndexableType type)
Description copied from interface:SolrCollectionResolverRetrieve the correct primary (foreground) Solr alias name for the givenIndexableType.- Specified by:
getPrimarySolrCollectionForTypein interfaceSolrCollectionResolver- Parameters:
type- Searchable type- Returns:
- The primary alias
-
getSecondarySolrCollectionForType
public String getSecondarySolrCollectionForType(com.broadleafcommerce.search.api.type.IndexableType type)
Description copied from interface:SolrCollectionResolverRetrieve the correct secondary (background) Solr alias name for the givenIndexableType.- Specified by:
getSecondarySolrCollectionForTypein interfaceSolrCollectionResolver- Parameters:
type- Searchable type- Returns:
- The secondary alias
-
getPrimarySolrCollectionForIndexable
public String getPrimarySolrCollectionForIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable)
Description copied from interface:SolrCollectionResolverRetrieve the correct primary (foreground) Solr alias name for the givenIndexable.- Specified by:
getPrimarySolrCollectionForIndexablein interfaceSolrCollectionResolver- Parameters:
indexable- Indexable item- Returns:
- The primary alias
-
getSecondarySolrCollectionForIndexable
public String getSecondarySolrCollectionForIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable)
Description copied from interface:SolrCollectionResolverRetrieve the correct secondary (background) Solr alias name for the givenIndexable.- Specified by:
getSecondarySolrCollectionForIndexablein interfaceSolrCollectionResolver- Parameters:
indexable- Indexable item- Returns:
- The secondary alias
-
getPrimarySolrCollectionForType
public String getPrimarySolrCollectionForType(String type)
Description copied from interface:SolrCollectionResolverRetrieve the correct primary (foreground) Solr alias name for the given type.- Specified by:
getPrimarySolrCollectionForTypein interfaceSolrCollectionResolver- Parameters:
type- Searchable type- Returns:
- The primary alias
-
getSecondarySolrCollectionForType
public String getSecondarySolrCollectionForType(String type)
Description copied from interface:SolrCollectionResolverRetrieve the correct secondary (background) Solr alias name for the given type.- Specified by:
getSecondarySolrCollectionForTypein interfaceSolrCollectionResolver- Parameters:
type- Searchable type- Returns:
- The secondary alias
-
-