Creating an Indexer
What is an indexer?
The standard approach to creating a custom indexer provider is to inherit from the
which will provide all of the functionality for writing and working with the Lucene index. It has all the methods which you need to implement to provide the operations such as:
- Adding nodes to the index
- Removing nodes from the index
- Rebuilding the index based on a data source
It also has all the events which can/ should be used for the different points of the indexers life cycle.
The methods that need to be implemented are:
protected abstract void PerformIndexAll(string type);
protected abstract void PerformIndexRebuild();
These methods are intended for your implementation to read from a data source and add each resulting item to the index using the abstract classes API.
Another implementation that is shipped with the Examine core is:
You can use this implementation to index data from a specified data source so all you would need to do is declare a data source. The easiest way to see how this works and can be implemented is to downlaod the "Examine web application demo for custom db
indexing" on the Downloads page.
Once you've created your indexer implementation you'll need to add it to config:
<add name="myIndexer" type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine" dataService="Examine.Web.Demo.TableDirectReaderDataService, Examine.Web.Demo" indexTypes="TestType" />