Class DefaultSolrCollectionResolver
java.lang.Object
com.broadleafcommerce.search.provider.solr.DefaultSolrCollectionResolver
- All Implemented Interfaces:
SolrCollectionResolver
Default implementation of the
SolrCollectionResolver
. 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 -
Constructor Summary
ConstructorsConstructorDescriptionDefaultSolrCollectionResolver
(@NonNull org.springframework.core.env.Environment environment) -
Method Summary
Modifier and TypeMethodDescriptiongetPrimarySolrCollectionForIndexable
(com.broadleafcommerce.search.api.domain.Indexable<?> indexable) Retrieve the correct primary (foreground) Solr alias name for the givenIndexable
.getPrimarySolrCollectionForType
(com.broadleafcommerce.search.api.type.IndexableType type) Retrieve the correct primary (foreground) Solr alias name for the givenIndexableType
.Retrieve the correct primary (foreground) Solr alias name for the given type.getSecondarySolrCollectionForIndexable
(com.broadleafcommerce.search.api.domain.Indexable<?> indexable) Retrieve the correct secondary (background) Solr alias name for the givenIndexable
.getSecondarySolrCollectionForType
(com.broadleafcommerce.search.api.type.IndexableType type) Retrieve the correct secondary (background) Solr alias name for the givenIndexableType
.Retrieve the correct secondary (background) Solr alias name for the given type.
-
Field Details
-
ALIAS_PROPERTY_PREFIX
- See Also:
-
PRIMARY_ALIAS_PROPERTY_SUFFIX
- See Also:
-
SECONDARY_ALIAS_PROPERTY_SUFFIX
- See Also:
-
-
Constructor Details
-
DefaultSolrCollectionResolver
public DefaultSolrCollectionResolver(@NonNull @NonNull org.springframework.core.env.Environment environment)
-
-
Method Details
-
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
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
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
-