Guest User

Untitled

a guest
May 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. public class ItemYear : AbstractComputedIndexField
  2. {
  3. public override object ComputeFieldValue(IIndexable indexable)
  4. {
  5. Item item = indexable as SitecoreIndexableItem;
  6.  
  7. DateTime date = EXTRACT DATE FROM THE ITEM;
  8.  
  9. return date.Year;
  10. }
  11. }
  12.  
  13. <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  14. <sitecore>
  15. <contentSearch>
  16. <indexConfigurations>
  17. <defaultLuceneIndexConfiguration type="Sitecore.ContentSearch.LuceneProvider.LuceneIndexConfiguration, Sitecore.ContentSearch.LuceneProvider">
  18. <documentOptions type="Sitecore.ContentSearch.LuceneProvider.LuceneDocumentBuilderOptions, Sitecore.ContentSearch.LuceneProvider">
  19. <fields hint="raw:AddComputedIndexField">
  20. <field fieldName="year" returnType="int">NAMESPACE.ItemYear , ASSEMBLY_NAME</field>
  21. </fields>
  22. </documentOptions>
  23. </defaultLuceneIndexConfiguration>
  24. </indexConfigurations>
  25. </contentSearch>
  26. </sitecore>
  27. </configuration>
Add Comment
Please, Sign In to add comment