0 Comments
Today, I spent a few hours on researching about how to implement custom index field with Examine in Umbraco7. There are plenty of resources talking about IndexUserField, IndexAttributeField but none of them is actually using custom field.

So I looked into the Umbraco API, and worked it out. If you knew Examine, you can ignore this part, and jump to the solution straightaway. Otherwise, I want to give you a little intro to what is Examine.

What is Examine?

Examine wraps the Lucene.Net API, which makes it easy for Umbraco developers to build index and search data [1]. Lucene open source search engine enable us to build a search driven and a high performance website.

What is custom index field?

Custom index field, also called "computed filed", is normally not existing in your database, but frequently used in program.

How to implement?


There might be other ways to implement "custom index field", but here I am going to introduce "UmbracoContentIndexer". UmbracoContentIndexer is an indexer for creating index document by getting data from Umbraco nodes. All you need to do is to add "custom index field" by overriding "GetDataToIndex" method.

Reference
[1] http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine