1

We have created the custom indexes on the newly set CD server based on the new publishing target using docker. Please quickly check one of the posted questions to get an idea of how I've set up the new publishing target-based CD.

We have modified the default index resolver of the OOB search in such a way that based on the scope used on the searchresults rendering we are getting the index name from the CMS according to the key-value pair like:

scope1 : sitecore_scope1_index

scope2 : sitecore_scope2_index

Below are the LOCs that we are using to check if the index exists and then get the index

if (indexName != null && IndexExists(indexName))
                        {
                            return ContentSearchManager.GetIndex(indexName);
                        }

protected virtual bool IndexExists(string indexId)
        {
            Log.Info($"Resolving index contentSearch/configuration/indexes/index[@id='" + indexId + "']", this);
            return Factory.GetConfigNode("contentSearch/configuration/indexes/index[@id='" + indexId + "']") != null;
        }

When IndexExists() method runs I get the following error in the logs:

3304 12:52:53 WARN  Results endpoint exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at Sitecore.ContentSearch.DefaultDocumentMapper`1.MapUsingSelectMethod[TElement](TDocument document, SelectMethod selectMethod, IReadOnlyCollection`1 virtualFieldProcessors, IReadOnlyCollection`1 executionContexts)
   at Sitecore.ContentSearch.SolrProvider.Mapping.SolrDocumentPropertyMapper.Sitecore.ContentSearch.SolrProvider.Mapping.ISolrDocumentMapper<System.Collections.Generic.Dictionary<System.String,System.Object>>.MapToType[TElement](Dictionary`2 document, SolrDocumentMapperContext`1 context)
   at Sitecore.ContentSearch.SolrProvider.SolrSearchResults`1.<GetSearchResults>d__21.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Sitecore.XA.Feature.Search.Controllers.SearchController.ProcessSearchItems(IEnumerable`1 items, QueryModel model)
   at Sitecore.XA.Feature.Search.Controllers.SearchController.GetResults(QueryModel model)

Nested Exception

Exception: System.ArgumentNullException
Message: Value cannot be null.
Parameter name: item
Source: Sitecore.Kernel
   at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName)
   at Sitecore.Data.Managers.ItemProvider.ApplySecurity(Item item, SecurityCheck securityCheck)
   at Sitecore.Data.ItemPath.DoGetPath(Item currentItem, String separator, ItemPathType type)
   at Sitecore.Data.ItemPath.DoGetPath(Item currentItem, String from, String separator, ItemPathType type)
   at Sitecore.Data.ItemPath.GetPath(Item currentItem, String from, String separator, ItemPathType type)
   at Sitecore.Data.ItemPath.get_LongID()
   at Sitecore.Caching.AccessResultCache.GetKey(ISecurable entity, Account account, AccessRight accessRight, PropagationType propagationType, Boolean includeAdditionalParameters)
   at Sitecore.Caching.AccessResultCache.AddRecord(ISecurable entity, Account account, AccessRight accessRight, PropagationType propagationType, AccessResult accessResult)
   at 

Sitecore.Security.AccessControl.ItemAuthorizationHelper.SaveDescendantAccessToCache(Item item, Account account, AccessRight accessRight, AccessResult accessResult)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAncestorAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Buckets.Security.AuthenticationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAncestorAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Buckets.Security.AuthenticationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAncestorAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Buckets.Security.AuthenticationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAncestorAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Buckets.Security.AuthenticationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAncestorAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Buckets.Security.AuthenticationHelper.GetItemAccess(Item item, Account account, AccessRight accessRight, PropagationType propagationType)
   at Sitecore.Security.AccessControl.ItemAuthorizationHelper.GetAccess(Item item, Account account, AccessRight accessRight)
   at Sitecore.Security.AccessControl.AuthorizationProvider.GetAccess(ISecurable entity, Account account, AccessRight accessRight)
   at Sitecore.Security.AccessControl.DefaultAuthorizationManager.GetAccess(ISecurable entity, Account account, AccessRight accessRight)
   at Sitecore.Security.AccessControl.DefaultAuthorizationManager.IsAllowed(ISecurable entity, AccessRight right, Account account)
   at Sitecore.Security.AccessControl.ItemAccess.CanRead()
   at Sitecore.Data.Managers.ItemProvider.ApplySecurity(Item item, SecurityCheck securityCheck)
   at Sitecore.Pipelines.ItemProvider.GetItem.GetLanguageFallbackItem.Process(GetItemArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Data.Managers.DefaultItemManager.GetItem(ID itemId, Language language, Version version, Database database, SecurityCheck securityCheck)
   at Sitecore.Data.Managers.DefaultItemManager.GetItem(ID itemId, Language language, Version version, Database database)
   at Sitecore.Data.Managers.ItemManager.GetItem(ID itemId, Language language, Version version, Database database)

I tried to use the SecurityDisabler() in IndexExist() method but even that did not help, and the same search result API works on the CM environment and gives proper results there.

The search result API that tries to get the index data is

https://preview.mysite.localhost//sxa/search/results/?l=en&s={1230D7E5-F409-410B-ACF0-A2C57B174A21}&itemid={34A4AD79-F824-4BB4-8FDA-FB6BB485D597}&sig=all-products&p=15&o=Is%20Featured%2CDescending&v=%7BC1CGH6BA-5F84-431B-8A6F-0B10628C6378%7D

and do not return the results but the same API (below) works on CM.

https://cm.mysite.localhost//sxa/search/results/?l=en&s={1230D7E5-F409-410B-ACF0-A2C57B174A21}&itemid={34A4AD79-F824-4BB4-8FDA-FB6BB485D597}&sig=all-products&p=15&o=Is%20Featured%2CDescending&v=%7BC1CGH6BA-5F84-431B-8A6F-0B10628C6378%7D

Any idea what can this be cause it doesn't work on CD?

FYI: I already checked the answer from the post on StackExchange but this suggests providing the entry of the custom indexes, in my case I have many custom indexes and we did not enter those on CM but still works.

1 Answer 1

0

I checked closely for one day all the custom configurations specific to the custom indexes and related to the new publishing target and got to know that some configs should have been there on the new publishing target but they were not.

The reason was that the configs were created by custom rule based patching and that rule was not matching due to the incomplete configuration and somewhere error was coming while reading the data from the sxa index.

So I modified the rule so that it patched on the newly publishing target correctly and then it all worked.

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.