This project is read-only.

Advanced Customisation

For projects where the default configuration options are not sufficient several methods have been provided to allow you to customise the package from your own code.


Examine Indexing Events

You can hook into any of the Umbraco examine events from your own code in the usual fashion. This allows control over the indexing process. For example you can edit the rendered HTML before it gets indexed, or cancel indexing on certain pages.

Firstly you'll need to subscribe to the events. This means running some code at Umbraco start-up, the usual way to accomplish this is in the constructor of a class that extends umbraco.BusinessLogic.ApplicationBase.
So, very very briefly, start an empty visual studio web app project, reference the relevant Umbraco dlls, examine dlls and the Governor.Umbraco.FullTextSearch dll, then create something like the below, build it, and stick the dll in your Umbraco bin directory. Consult the Umbraco site for better documentation on this that took more than 5 minutes to write... 

namespace MyAddon
	public class MyEvents : umbraco.BusinessLogic.ApplicationBase
		public MyEvents()
			BaseIndexProvider indexer = ExamineManager.Instance.IndexProviderCollection["FullTextIndexer"];
			indexer.NodeIndexing += new EventHandler(indexer_NodeIndexing);

		void indexer_NodeIndexing(object sender, IndexingNodeEventArgs e)
			// do stuff

Depending on your version of Umbraco, umbraco.BusinessLogic.ApplicationBase might be deprecated and you'll need to use the appropriate method.

There are a number of events built into examine, documentation doesn't seem to be readily available, but you can look through the code, or just use intellisense to pick them out. If you want to edit the rendered HTML or cancel indexing then NodeIndexing is the one to use.

Search Results Event

There's an event in the search helper that's fired once for every search result.
You can access this at SearchExtension.ResultOutput . This will allow you to change/add/delete any of the content that's about to be pushed out to the Razor, giving you more flexibility in what to display.

Swapping Indexers and Renderers

It's also possible to override the way FullTextSearch renders, and then indexes pages completely, or just for a certain node type.

To get a sense of the way it works you'll probably need to look over the code-base for FullTextSearch. But some basic information is included here that should be enough to get you started.

To clarify, the renderer reads the page's full HTML and returns it.
The indexer controls which pages get indexed and how the HTML is stripped.
When the renderer runs is determined by the PublishEventRendering setting in FullTextSearch.config, if this is set to true it will run immediately after publishing, and a page publish won't return until the renderer does. If PublishEventRendering is set to false (this is the default setting) then the default indexer will call the renderer during the indexing phase, and page publishing doesn't have to wait for the renderer to return.


FullTextSearch can use any class that implements the interface IDocumentRenderer to render documents. You can replace the default renderer entirely, inherit and extend/override it, and do either of these conditional on the type of node being rendered. An example will probably make this easier to understand...

Override Renderer for node type "umbHomepage" to add the text "Dummy Homepage Text" onto the end of the full text index  

public class MyEvents : umbraco.BusinessLogic.ApplicationBase
	public MyEvents()

public class MyRenderer : DefaultHttpRenderer
	public override bool Render(int nodeId, out string fullHtml)
		if (base.Render(nodeId, out fullHtml))
			fullHtml += "Dummy Homepage Text";
			return true;

		return false;

 Override renderer for all node types 


Have a look at the code to get a better idea of how it works. One thing to bear in mind is that you can only use the Umbraco node factory API if PublishEventRendering is set to true in the FullTextSearch.config file. Otherwise you'll need to use the Document API.


Indexers can be overridden in much the same way as renderers. e.g. 


The class "MyIndexer" will need to implement IFullTextIndexer.

Bear in mind that if PublishEventRendering is not active your indexer will need to handle calling the appropriate renderer, or just inherit the existing DefaultIndexer class.

Scheduled Indexing

In the event that content on your site changes regularly without any nodes being published a web service is provided which allows you to

  1. Trigger a full re-creation of the site index
  2. Re-index a list of nodes

It is envisaged that this service be called by means of a scheduled task of some kind. No mechanism for doing this is currently provided, though a console application may be added in future.

The web service is provided in a separate package to the main FullTextSearch. You can download it from the downloads page.

It requires the file umbraco.webservices.dll, which is not present by default on some umbraco installations. If your install lacks this file you can build it yourself from the umbraco source, or download it from the downloads page for Umbraco 4.7.0

The web service is located at /umbraco/webservices/FullTextService.asmx . There are four methods of interest:

RebuildFullTextIndex(string username, string password) : Trigger a full re-indexing of the site. Be warned that this deletes the current index completely. So search will be unavailable until re-indexing is completed, which happens at a rate of about 5 pages/sec on my development box.

ReindexFullTextNodes(string username, string password, int[] nodes) : Re-index the supplied list of nodes

ReindexFullTextNodesAndChildren(string username, string password, int[] nodes) : Re-index the supplied list of nodes and all their children.

ReindexAllFullTextNodes(string username, string password) : Re-index all nodes one-by-one.

You can also trigger these actions from your own code using the FullTextSearch.Admin.AdminActions class


Installation Instructions

Settings and Basic Customisation


Last edited Jul 2, 2013 at 4:25 PM by governor, version 12


No comments yet.