Search policies

Version: 10.0

The Sitecore.Commerce.Plugin.Search.SearchPolicy contributes configuration policies that define common settings applicable to multiple search providers.

Note

Do not extend or inherit from out-of-the-box policies; instead, create your own.

You can change the values of default policies by modifying the PolicySet JSON or the Environment JSON, depending on where the policy is defined, and then re-running Bootstrap.

The following policies can be configured through the Search plugin:

Policy

Description

Properties / Default Values

IndexablePolicy

Defines which View fields to index for a particular entity.

Each indexable EntityType can have an IndexableView that the Commerce Engine retrieves to determine which entity properties to index. For a specific view, each ViewProperty (i.e., field) must have an Indexable policy that defines the settings for the index, which fields the index has, their type, whether they are searchable, filterable, and so on.

Each field to be indexed must have the following properties defined in the Indexable policy:

  • IsKey

  • IsSearchable

  • IsFilterable

  • IsSortable

  • IsFacetable

  • IsRetrievable

The indexing blocks use the values set for the field’s properties to build the index and update/insert documents into the index.

Note

The isKey property can only be set to true for one field. If multiple fields have the isKey property set to true, validation fails when the minion creates or updates the index.

SearchScopeName \

Properties \ ConcurrentDictionary<string, IndexableSettings>

ItemIndexablePolicy

Defines the field type mappers.

KnownSearchActionsPolicy

Defines the names of the search view actions.

Search \ "Search"

DeleteSearchIndex \"DeleteSearchIndex"

UpdateSearchIndex \"UpdateSearchIndex"

CreateSearchIndex \"CreateSearchIndex"

KnownSearchViewsPolicy

Defines the names of the search views.

Documents \ "Documents"

Document \ "Document"

Search \ "Search"

SearchResults \"SearchResults"

SearchResult \ "SearchResult"

Indexes \ "Indexes"

Index \ "Index"

SearchPolicy

Provides the ability to further control the amount of data that is sent to the underlying search service.

"MaxNumberOfRows": Gets or sets a value indicating the max number of rows (documents) to use in the query request for an index. If a search query does not specify the number of rows, this is the max value that is used.

"IndexBatchSize": Splits up result sets into smaller batches. This is useful during the item indexing where the minion processes 1000 entities at a time by default. That number is then multiplied by the number of languages in the system and can result in potentially long-running and expensive calls to the search service. Setting the batch size slices up the original result set before submitting it to the search index.

"DeleteBatchSize": Currently used specifically during the incremental item indexing, only where items are being removed from the index before re-indexing them. Gives more granular control over the number of documents that are deleted in one batch to reduce the impact on the search service.

"ConcurrentIndexingOperations": Allows to control how many batches are indexed in parallel.

MaxNumberOfRows=1000000

"IndexBatchSize": 100

"DeleteBatchSize": 50

"ConcurrentIndexingOperations": 1

SearchScopePolicy

Defines the type of entity to be added to the index.

Indexing minions use the SearchScope policy to ensure that the appropriate entity types are put into indexable lists. When commerce entities are persisted, the index minion checks the entity type against the Search Scope policy. If the policy specifies the relevant entity type, the minion adds the entity to the incremental list specified in the policy.

The policy also defines a set of tags that can be used to add or remove data from the search results, and specifies the list to watch for updates to the entity.

Name \

IncrementalListName \

FullListName \

EntityTypeNames \

DeletedListName \

ResultDetailsTags \List<Tag>()

SearchViewPolicy

Defines the settings for the search and search results entity views.

When a view is requested, a block in the IGetEntityViewPipeline checks for a SearchViewPolicy for the requested view. If a SearchViewPolicy is found, the pipeline adds the search view as a child of the requested view.

SearchScopeName \

ViewName \

PageSize \ 10

PageSizeOptions \ List<int> { 5, 10, 25, 100

SitecoreItemRebuildIndexNamePolicy

Defines the index name to use to rebuild sitecore indexes

SitecoreItemSearchScopePolicy

Defines whether the index is the master index or not.

IsMasterIndex (bool.)

AzureDataTypeMap

Maps system types to Azure DataTypes.

<SetTypeValue>

AzureSearchPolicy

Defines the search policy for the Azure search provider.

SearchServiceName/

SearchServiceAdminApiKey/

SearchServiceQueryApiKey/

SolrSearchPolicy

Defines the search policy for the SOLR search provider.

IsSolrCloud\

SolrDateTimeFormatString\

ConnectionTimeout\

UseSolrAuthentication\

SolrUserName\

SolrPassword\

Do you have some feedback for us?

If you have suggestions for improving this article,