Created
May 8, 2015 15:37
-
-
Save micklaw/a9e41b513fd7dfd69ea8 to your computer and use it in GitHub Desktop.
Inject Examine Fields
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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