Last active
August 22, 2016 17:54
-
-
Save soen/a387251b70ae3970201845729e0889ba to your computer and use it in GitHub Desktop.
This file contains 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 class MyComputedIndexField : IComputedIndexField | |
{ | |
public object ComputeFieldValue(IIndexable indexable) | |
{ | |
// Check that we have something to index | |
if (indexable == null) | |
return null; | |
// Check that it is a Sitecore indexable item | |
var indexableItem = indexable as SitecoreIndexableItem; | |
if (indexableItem == null) | |
return null; | |
// We're in business, let's grab the Sitecore item being indexed, and do stuff! | |
Item sitecoreItem = indexableItem.Item; | |
// Sneaky computations goes here... | |
// Finally we return the value, that we need to store in the search index | |
return "The value stored in the index"; | |
} | |
public string FieldName { get; set; } | |
public string ReturnType { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment