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 String
ALIAS_PROPERTY_PREFIX
static String
PRIMARY_ALIAS_PROPERTY_SUFFIX
static String
SECONDARY_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 String
getPrimarySolrCollectionForIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable)
Retrieve the correct primary (foreground) Solr alias name for the givenIndexable
.String
getPrimarySolrCollectionForType(com.broadleafcommerce.search.api.type.IndexableType type)
Retrieve the correct primary (foreground) Solr alias name for the givenIndexableType
.String
getPrimarySolrCollectionForType(String type)
Retrieve the correct primary (foreground) Solr alias name for the given type.String
getSecondarySolrCollectionForIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable)
Retrieve the correct secondary (background) Solr alias name for the givenIndexable
.String
getSecondarySolrCollectionForType(com.broadleafcommerce.search.api.type.IndexableType type)
Retrieve the correct secondary (background) Solr alias name for the givenIndexableType
.String
getSecondarySolrCollectionForType(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:SolrCollectionResolver
Retrieve the correct primary (foreground) Solr alias name for the givenIndexableType
.- Specified by:
getPrimarySolrCollectionForType
in interfaceSolrCollectionResolver
- Parameters:
type
- Searchable type- Returns:
- The primary alias
-
getSecondarySolrCollectionForType
public String getSecondarySolrCollectionForType(com.broadleafcommerce.search.api.type.IndexableType type)
Description copied from interface:SolrCollectionResolver
Retrieve the correct secondary (background) Solr alias name for the givenIndexableType
.- Specified by:
getSecondarySolrCollectionForType
in interfaceSolrCollectionResolver
- Parameters:
type
- Searchable type- Returns:
- The secondary alias
-
getPrimarySolrCollectionForIndexable
public String getPrimarySolrCollectionForIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable)
Description copied from interface:SolrCollectionResolver
Retrieve the correct primary (foreground) Solr alias name for the givenIndexable
.- Specified by:
getPrimarySolrCollectionForIndexable
in interfaceSolrCollectionResolver
- Parameters:
indexable
- Indexable item- Returns:
- The primary alias
-
getSecondarySolrCollectionForIndexable
public String getSecondarySolrCollectionForIndexable(com.broadleafcommerce.search.api.domain.Indexable<?> indexable)
Description copied from interface:SolrCollectionResolver
Retrieve the correct secondary (background) Solr alias name for the givenIndexable
.- Specified by:
getSecondarySolrCollectionForIndexable
in interfaceSolrCollectionResolver
- Parameters:
indexable
- Indexable item- Returns:
- The secondary alias
-
getPrimarySolrCollectionForType
public String getPrimarySolrCollectionForType(String type)
Description copied from interface:SolrCollectionResolver
Retrieve the correct primary (foreground) Solr alias name for the given type.- Specified by:
getPrimarySolrCollectionForType
in interfaceSolrCollectionResolver
- Parameters:
type
- Searchable type- Returns:
- The primary alias
-
getSecondarySolrCollectionForType
public String getSecondarySolrCollectionForType(String type)
Description copied from interface:SolrCollectionResolver
Retrieve the correct secondary (background) Solr alias name for the given type.- Specified by:
getSecondarySolrCollectionForType
in interfaceSolrCollectionResolver
- Parameters:
type
- Searchable type- Returns:
- The secondary alias
-
-