I am updating index dependencies as mentioned in
Sitecore Full Content Search where we are using GetDatasourceDependencies
.
Now, the issue is that this works fine for the English language, but, whenever I publish content for a non-English version, it's still taking dependency in the English version, but the dependency for published item is actually in a non-English version. where as Item object is in fr-FR version as returned by this piece of code Item item = (Item)(context.IndexedItem as SitecoreIndexableItem); it's dependency is still returned in English version i think last two lines of processor need to pass language code some where but not sure where
My Pipeline code is like this:
public class GetDatasourceDependencies : BaseProcessor
{
public override void Process(GetDependenciesArgs context)
{
Func<ItemUri, bool> func = null;
Assert.IsNotNull(context.IndexedItem, "indexed item");
Assert.IsNotNull(context.Dependencies, "dependencies");
Item item = (Item)(context.IndexedItem as SitecoreIndexableItem);
if (item != null)
{
if (func == null)
{
func = uri => (bool)((uri != null) && ((bool)(uri != item.Uri)));
}
System.Collections.Generic.IEnumerable<ItemUri> source = Enumerable.Where<ItemUri>(from l in Globals.LinkDatabase.GetReferrers(item, FieldIDs.LayoutField) select l.GetSourceItem().Uri, func).Distinct<ItemUri>();
context.Dependencies.AddRange(source.Select(x => (SitecoreItemUniqueId)x));
}
}
}
How to correctly process index dependencies for correct language?
Item item = (Item)(context.IndexedItem as SitecoreIndexableItem);
is of fr-FR version it's still returning dependency in English version