2

I am trapped in issues with bucketed item as below.

Details: This is Sitecore PaaS Scaled environment.

  1. We have bucketed media items when we create any item those are getting created in CM.

  2. We can see those items reflecting in CM role.

  3. We are successfully able to Publish those to CD(Web database).

  4. Now the issues come which is these item is not coming and showing up on the page.

  5. We have a caching situation with Clear cache on Index update on this particular rendering.

Quick help will boost my confidence to work on this.

Adding more information as Micheal mentioned

We have code like below and rendering has the logic of filtering this with date time to show specific items.

public List<T> GetAllItemsFromBucket(string bucketPath) { var index = ContentSearchManager.GetIndex("{index name}"); using (var context = index.CreateSearchContext()) { var results = context.GetQueryable<T>().Where(x => x.Path.StartsWith(bucketPath)).ToList(); return results; } }

the thing is this was working before it stopped working after Sitecore added patch for CD servers for manual indexing strategy.

adding to the above. which I believe causing the issue. So my question is how to mitigate this? given the condition, we can't change indexing strategy

6
  • Can you provide details on how the items are queried and rendered to the page? Publishing alone does not tell the whole story. – Michael West Oct 17 '19 at 3:13
  • @MichaelWest We have code like below and rendering has the logic of filtering this with date time to show specific items. public List<T> GetAllItemsFromBucket(string bucketPath) { var index = ContentSearchManager.GetIndex("{index name}"); using (var context = index.CreateSearchContext()) { var results = context.GetQueryable<T>().Where(x => x.Path.StartsWith(bucketPath)).ToList(); return results; } } the thing is this was working before it stopped working after Sitecore added patch for CD servers for manual indexing strategy. – Nikhil Kulkarni Oct 17 '19 at 4:37
  • adding to the above. which I believe causing the issue. So my question is how to mitigate this? given the condition, we can't change indexing strategy – Nikhil Kulkarni Oct 17 '19 at 4:43
  • Can you please move the details into your original question? – Michael West Oct 17 '19 at 4:55
  • few questions 1). is this working on master database, try to preview the page to make sure it is not a publishing issue 2). are you using the correct "index name"? 3). In comments you are saying you have manual indexing strategy which means you need to do manually reindex, did you perform that? – Mahendra Shekhawat Oct 17 '19 at 5:57
0

I found an answer to this question which is as below.

The issues was in code.

We were using blow two lines which were causing pointing to wrong index.

Old Code(Which was working for Lucene but not for Solr):

            var indexable = new SitecoreIndexableItem(bucketItem);
            var index = ContentSearchManager.GetIndex(indexable);

I made the change to get right index as per role which is like for CD role you need to get index which your using, in my case it is web so I have written condition like below which resolved my Issue.

New Code(Which is working for Solr):

var env = AppSettings.ContactServerEnvironment;
        var index = ContentSearchManager.GetIndex("sitecore_web_index");
        if (env.Contains("CM"))
        {
            index = ContentSearchManager.GetIndex("sitecore_master_index");
        }

Root Cause Analysis

After changing this I done a root cause analysis for this issue and found that previously we were using Lucene. And below are the points which will clarify the cause.

  1. As Search engine was Lucene previously the index were working fine for buckets.
  2. Then I checked that the two lines which were wrong actually providing the right index when I pointed search engine to Lucene.
  3. SO now when we change this to Solr as obvious Solr use different logic all together to find index we changed the logic accordingly.

Note: This was more of the mistake from code-side while upgrading search engine from Lucene to Solr.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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