2

This seems to be a SOLR caching issue. In the code below after doing a publish the index is supposed to be updated. Updating the same item through content editor, it has the same issue. It does not hit the code in Content Editor. Restarting IIS makes the updated item appear in the index. Any ideas on this?

var targetDatabase =
                    Database.GetDatabase(Website.Foundation.Common.Classes.Constants.Databases.Name);
                var publishOptions = new PublishOptions(item.Database, targetDatabase, PublishMode.Full,
                    item.Language, DateTime.Now);
                var publisher = new Publisher(publishOptions);
                publisher.Options.RootItem = item;
                publisher.Options.Deep = true;
                publisher.Publish();var targetDatabase =
                    Database.GetDatabase(Website.Foundation.Common.Classes.Constants.Databases.Nam);
                var publishOptions = new PublishOptions(item.Database, targetDatabase, PublishMode.Full,
                    item.Language, DateTime.Now);
                var publisher = new Publisher(publishOptions);
                publisher.Options.RootItem = item;
                publisher.Options.Deep = true;
                publisher.Publish();var toIndex = ContentSearchManager.GetIndex("sitecore_web_index");
                if (toIndex != null)
                {
                    toIndex.Update(new SitecoreItemUniqueId(item.Uri));
                }
3

I suggest you try to update specific item in index by using IndexCustodian. It works in asynchronous way, creates Sitecore job and put it in the Event queue.

var uniqueId = new SitecoreItemUniqueId(item.Uri);
IndexCustodian.UpdateItem(index, uniqueId);

Also I suggest you to switch Crawling log to DEBUG level to check more detailed what happens.

You should see something like:

INFO [Index=sitecore_web_index] Updating '1' items from Event Queue.
DEBUG IndexCustodian. IncrementalUpdate triggered on index sitecore_web_index. Data=Count=1
DEBUG [Index=sitecore_web_index] Committing: Add: 0; Update:1; DeleteUnique: 0; DeleteGroup: 0

May be the problem is in Event queue, you can also check if [dbo].[EventQueue] table in Core database.

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.