Sunday, February 28, 2016
There are many live scenarios in sitecore application where we need to update the index to reflect the changes on website (UI). As sitecore recommended we use solr/lucence search index to play with huge data or search.
Some time we need to update some items or particular one item to update the index file.
So here is the way to update the single item in index file:
1. Go to sitecore
2. Go to developer tab: by default its hidden to show a developer tab, right-click a tab, and then select the tab to show > developer.
3. Or go to ribbons > my toolbar >Customize>Add Re-index Tree under indexing tools
4. Now select the item which you want to rebuild the index
5. Click on Re-index tree button > it will re build the index of selected item and its descendants.
Wednesday, February 24, 2016
Publish items only, if available in the target database.
One of my client requirement was to publish only those items which have version available in the target database, if we found any item which doesn’t exist in target database or don’t have a version in current language then don’t publish that particular item.
So here is the solution:
Override the publish:itemProcessing
Add below config file in App_config>Include>ItemProcessedEvent.config
<handler type="Namespace.className, " method="OnItemProcessing" />
Create the class with desired name and add below method:
public void OnItemProcessing(object sender, EventArgs args)
var argsProcessing = (ItemProcessingEventArgs)args;
var context = argsProcessing.Context;
Assert.IsNotNull(context, "ItemProcessedIndexingEvent.OnItemProcessing: Cannot get PublishItem context");
var sourceItem = context.PublishHelper.GetSourceItem(context.ItemId);
var targetItem = context.PublishHelper.GetTargetItem(context.ItemId);
if (targetItem == null || (sourceItem.Database.GetItem(sourceItem.ID, Sitecore.Context.Language).Versions.Count > 0 && targetItem.Database.GetItem(sourceItem.ID, Sitecore.Context.Language).Versions.Count <= 0))
argsProcessing.Cancel = true;
catch (Exception ex)
Solution: if you publish site, folder with sub items or single item, the publishing will check if item and language version is available in target database, then only it will publish it otherwise that particular item will skip from publishing.
Please feel free to provide your valuable input/feedback
A quick walk through of Sitecore helix on how to setup a Sitecore website based on Helix Architecture from scratch/blank solutio...
Excited to share this great information, G o live with Sitecore 9 update1 on Azure PaaS. We dared to opt the...
Don’t want to save the duplicate data in the form? This is very basic requirement for each type of forms, Email id shoul...
What is Tagging? Tagging refers to the metadata of the content which is assigned to a content by the content creator and the r...