Blog Post

Creating custom index and search on tags field

Thursday, June 2, 2016 10:07 PM

Creating new index for umbraco 7 based on tags


I am building search to this site to search blog posts based on tags.

Tags field is build in functionality into Umbraco 7.x


Now I have displaying the tags and assigned to most of my blog posts but as yet it does not link to another blog posts that are related.


I decided to use existing search provided build on top of Lucene search engine.

Setting up Examine search

First open your project location and find

following files:

  • ExamineIndex.config
  • ExamineSettings.config

This files are by default located in config folder.


Fist we need to create index.

this file is used as definition of what will be included in index, on which we will search.

The less data this has the faster it is (usually) so try to keep it small.


lets insert following at the end of 

... existing xml ...
 <IndexSet SetName="TagsIndexSet" IndexPath="~/App_Data/TEMP/Test/ExamineIndexes/{machinename}/Tags/">
<add Name="id" />
<add Name="nodeName"/>
<add Name="updateDate" />
<add Name="writerName" />
<add Name="nodeTypeAlias" />
<add Name="tags" />

The set name has to end with IndexSet in the end. 


Next we need to define searcher

lets open ExamineSettings.config and create searcher. This one is bit more complex but the gist is the same add new item


 ... existing providers ...
  <add name="TagsIndexer" type="UmbracoExamine.UmbracoContentIndexer, UmbracoExamine" />


and for the provider we need to have in the end Indexer

When we have this part completed we need to define search providers using xml snippet below



... existing providers ...
<add name="TagsSearcher" type="UmbracoExamine.UmbracoExamineSearcher, UmbracoExamine"
analyzer="Lucene.Net.Analysis.Standard.StandardAnalyzer, Lucene.Net" enableLeadingWildcard="true"/>

And again the name should end with "Searcher" to keep it consistent.

After this we need only restart application and ensure we have read write rights to the location defined.

before adding new configuration

before adding new configuration

after adding new configuration and application started again

after adding new configuration and application started again

The generation might take some time as we have set it to async, as it depends on number of your articles it needs to process to generate your index.