We are trying to get the data from one of the custom indexes and the data comes on CM and CD (web DB based) but we have created a new CD based on the new publishing target as a preview and there data doesn't come from the same index.

I checked the solr query in the logs, everywhere the query is the same on preview, cm, and cd (web). But when we load the data on preview cd then it does not return the data for the same query.

We have completely published the site on preview target.

We checked that data is also available in our custom index (obviously it should be there because it comes on cm and cd web but thought to check as I am stuck). So not sure why isn't it coming for the new preview.

Below is the query:

Solr Query - ?q=(((((((_path:(2ded2b03fsdfsg4cd2a46719ee) AND _template:(f7b5c470bsadfsg817bd9ac14af)) AND product_capabilities_sm:(0da4c6372aFSDF9ceddb77af3)) AND _latestversion:("True")) AND (has_country_restrictions_b:("False") OR country_availability_sm:(41239aSADFF38683cf83b7))) AND ((_path:("c83165SDFSDF9018d1b6cb4f") AND searchable_b:("True")) OR (_path:("fbdc2262a61a4SDFSD4a22d720") AND searchable_b:("True")) OR (_path:("00b9edfdFDSF7eb52c67") AND searchable_b:("True")) OR (_path:("a41bbe42fedd4asdsc6a10f") AND searchable_b:("True")) OR (_path:("685c0cdee82dsdsde6000f2a1fb") AND searchable_b:("True")) OR (_path:("c609e8ddsfsf9b1aee4f23") AND searchable_b:("True")) OR (_path:("a397f54d7sdsdcb067c016b7fe") AND searchable_b:("True")) OR (_path:("21b82c37d18b4sdsdbd7e43") AND searchable_b:("True")) OR (_path:("738c74fe88bc43sdsd3517281b6815") AND searchable_b:("True")) OR (_path:("ca63b9343sdsde71f4419") AND searchable_b:("True")) OR (_path:("27c198172dsdsd609df0d608b") AND searchable_b:("True")) OR (_path:("190fae814e7b445dbb4fe771a6946d16") AND searchable_b:("True")) OR (_path:("b240656ffaasdsdd5d3e684") AND searchable_b:("True")))) AND _language:("en")) AND _latestversion:("True")) AND _val_:__boost&start=0&rows=0&fq=(((-_readaccess:("U-_extranet\\Anonymous") *:*) AND ((-_readaccess:("R-_sitecore\\Coveo Configuration Admin") *:*) OR _readaccess:("U+_extranet\\Anonymous"))) AND (((-_readaccess:("R-_Everyone") *:*) AND (-_readaccess:("R-_extranet\\Everyone") *:*)) OR _readaccess:("R+_sitecore\\Coveo Configuration Admin") OR _readaccess:("U+_extranet\\Anonymous")))&fq=_indexname:(sitecore_taxes_web_index)&facet=true&facet.field=taxonomy_industry_name_list_sm&f.taxonomy_industry_name_list_sm.facet.mincount=1&facet.field=product_group_name_list_sm&f.product_group_name_list_sm.facet.mincount=1&facet.field=is_sustainable_application_b&f.is_sustainable_application_b.facet.mincount=1&facet.field=has_autonomy_b&f.has_autonomy_b.facet.mincount=1&wt=xml

Any suggestions for how to troubleshoot the query environment specific, to know why query behaves fine on cd web but not on the cd preview?

Update-1: I checked that var i = searchContext.GetQueryable<CapabilityProductMappingSearchResultItem>(); line is not giving the result for the new CD but the same give to cd web. This code created the search context on the same index used for cd web and new publishing target based cd.

[PredefinedQuery("TemplateId", ComparisonType.Equal, "1245f04e-1758-4e94-a8eb-d90e433f750c", typeof(ID))]
    public class CapabilityProductMappingSearchResultItem : SearchResultItem
        public List<Guid> Capability { get; set; }

        public List<Guid> ProductGroup { get; set; }

        public List<Guid> Products { get; set; }
  • Is it definitely the exact same SOLR end point and Core being targeted? If the same query is being generated, then the same response should be returned from SOLR. Try changing the "web" connection string on your preview instance to point to the same web db from your CD instance. If that fixes the problem, then some item or template ma not have been published that the view relies on? Jan 10 at 15:59
  • @DeanOBrien I have updated my question to provide more context based on the investigation that I did, maybe that can help. Jan 11 at 5:40
  • Hi Prashant, In your query, I see 'fq=_indexname:(sitecore_taxes_web_index)'. It seems your code is calling web indexes instead of preview. Jan 11 at 9:12
  • @VikrantPunwatkar We have kept it deliberately according to client requirements but the question is that same index works for cm and cd (web) but why not for cd (preview)? Jan 11 at 9:36

1 Answer 1


I have further done the RCA and found that

  1. when we are reading the index on the publishing target then it is reading the web index because in the site settings item, the Database field had the web DB selected, and due to the code sitecore_custom_{sitecore.context.database.name}_index it was coming as (sitecore_custom_web_index) and in the SOLR query it includes a predicate like fq=_indexname:(sitecore_custom_web_index).
  2. I checked the returned data on the SOLR portal and then noticed that there is one field _indexname that includes the name of the index and this value is the name of the core mentioned for your index.
  3. When we were reading the data with the web index on the new publishing target based cd I also noticed that in the project the web index was patched with the preview's index's core name and fq was sending the name of the web index as fq=_indexname:(sitecore_custom_web_index) but the web index is patched with preview's core, so the documents returned are having the _indexname field to be sitecore_custom_preview_index.
  4. Therefore, while reading the web index, fq is passing the _indexname:(sitecore_custom_web_index) but the core is sitecore_custom_preview_index so documents returned as part of the query has the _indexname as sitecore_custom_preview_index so this is not matching as per the SOLR query generated, and the count is not same as should have been with web.

Now to resolve this we can modify the fq to send the _indexname to be the core name (sitecore_custom_preview_index) instead of _indexname (sitecore_custom_web_index). But, this is not possible as per https://stackoverflow.com/questions/38571353/clear-all-filterquery-in-sitecore-contentsearch-linq-query

So, we are now making the new preview's context change to preview, by selecting the preview DB in the site setting item' Database field so that _indexname can be passed as (sitecore_custom_preview_index) instead of _indexname (sitecore_custom_web_index)

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.