Skip to content

Instantly share code, notes, and snippets.

@micklaw
Created May 8, 2015 15:37
Show Gist options
  • Save micklaw/a9e41b513fd7dfd69ea8 to your computer and use it in GitHub Desktop.
Save micklaw/a9e41b513fd7dfd69ea8 to your computer and use it in GitHub Desktop.
Inject Examine Fields
public void InjectToExamineNode(int id, Dictionary<string, string> newFields = null)
{
if (newFields.HasContent())
{
var content = new Content(id);
if (content.Id > 0)
{
var doc = content.ToXDocument(false).Root;
if (doc != null)
{
foreach (var newField in newFields)
{
doc.Add(new XElement(newField.Key, newField.Value));
}
_indexer.DeleteFromIndex(id.ToString());
_indexer.ReIndexNode(doc, IndexTypes.Content);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment