1

We have created a version of sellable items in the product catalog. It is in the draft mode. When I search the same item, we found two different items in the sitecore_web_index. One for the earlier version and another is for draft version.

As per my understanding, once the product catalog will be approved and published, it should go to the sitecore_web_index.

Please can somebody will help me in not getting index of the draft version of the sellable item.

1 Answer 1

7

This is controlled by the Sitecore.Commerce.Core.IgnorePublishedPolicy, if the environment you're passing in your request contains this policy then both published & unpublished entities will be returned in any requests.

Out of the box the HabitatAuthoring environment contains this policy, whereas the HabitatShops doesn't.

To make sure you get the correct values in your indexes your crawlers should pass in HabitatAuthoring for the master index and HabitatShops for your web index.

Out of the box the master index definition includes these default crawlers...

<crawler type="Sitecore.Commerce.Engine.Connect.Search.Crawlers.CatalogsCrawler, Sitecore.Commerce.Engine.Connect" patch:source="Sitecore.Commerce.Engine.Connectors.Index.Solr.config">
  <ItemsToTake>100</ItemsToTake>
  <ListName>Catalogs</ListName>
  <IndexListName>CatalogsIndex</IndexListName>
  <Environments hint="list">
    <environment>HabitatAuthoring</environment>
  </Environments>
  <Database>master</Database>
</crawler>
<crawler type="Sitecore.Commerce.Engine.Connect.Search.Crawlers.CategoriesCrawler, Sitecore.Commerce.Engine.Connect" patch:source="Sitecore.Commerce.Engine.Connectors.Index.Solr.config">
 <ItemsToTake>100</ItemsToTake>
  <ListName>Categories</ListName>
  <IndexListName>CategoriesIndex</IndexListName>
  <Environments hint="list">
    <environment>HabitatAuthoring</environment>
  </Environments>
  <Database>master</Database>
</crawler>
<crawler type="Sitecore.Commerce.Engine.Connect.Search.Crawlers.SellableItemsCrawler, Sitecore.Commerce.Engine.Connect" patch:source="Sitecore.Commerce.Engine.Connectors.Index.Solr.config">
  <ItemsToTake>100</ItemsToTake>
  <ListName>SellableItems</ListName>
  <IndexListName>SellableItemsIndex</IndexListName>
  <Environments hint="list">
    <environment>HabitatAuthoring</environment>
  </Environments>
  <Database>master</Database>
</crawler>

The Web index includes these default crawlers...

<crawler type="Sitecore.Commerce.Engine.Connect.Search.Crawlers.CatalogsCrawler, Sitecore.Commerce.Engine.Connect" patch:source="Sitecore.Commerce.Engine.Connectors.Index.Solr.config">
  <ItemsToTake>100</ItemsToTake>
  <ListName>Catalogs</ListName>
  <IndexListName>CatalogsIndex</IndexListName>
  <Environments hint="list">
    <environment>HabitatShops</environment>
  </Environments>
  <Database>web</Database>
</crawler>
<crawler type="Sitecore.Commerce.Engine.Connect.Search.Crawlers.CategoriesCrawler, Sitecore.Commerce.Engine.Connect" patch:source="Sitecore.Commerce.Engine.Connectors.Index.Solr.config">
  <ItemsToTake>100</ItemsToTake>
  <ListName>Categories</ListName>
  <IndexListName>CategoriesIndex</IndexListName>
  <Environments hint="list">
    <environment>HabitatShops</environment>
  </Environments>
  <Database>web</Database>
</crawler>
<crawler type="Sitecore.Commerce.Engine.Connect.Search.Crawlers.SellableItemsCrawler, Sitecore.Commerce.Engine.Connect" patch:source="Sitecore.Commerce.Engine.Connectors.Index.Solr.config">
  <ItemsToTake>100</ItemsToTake>
  <ListName>SellableItems</ListName>
  <IndexListName>SellableItemsIndex</IndexListName>
  <Environments hint="list">
    <environment>HabitatShops</environment>
  </Environments>
  <Database>web</Database>
</crawler>

Notice how the environment name being passed in changes between the master & web definitions. This is what controls whether unpublished entities are indexes or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.