Indexing External Data using Examine/Umbraco

Use Examine to index and search any data source.

Posted on Thursday, August 04, 2016


You can use Examine with it’s embedded Lucene.Net with any data source and you can do it is fairly straightforward.

The easiest way is to create your own ISimpleDataService. This allows you to build a custom examine index from any source you like. All you have to do is write code to retrieve the data and then convert it into an Examine SimpleDataSet. 

In this example I am going to index a  SQL Server TABLE.

1st Step is to retrieve the data from the table. I am using Simple.Data (docs at: http://simplefx.org/simpledata/docs/) ("Simple.Data is a lightweight framework that uses the dynamic features of .NET 4 to provide an expressive, ORM-ish way of accessing and manipulating data without any of the code pre-generation and boilerplate required by other frameworks.")

2nd Step is to convert this data into an IEnumerable<SimpleDataSet> 

 

Within Umbraco website we just need to set up the Examine Settings...

within ExamineIndex.config:

<IndexSet SetName="CustomIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/{machinename}/CustomIndexSet">
<IndexUserFields>
<add Name="title" />
<add Name="author" />
</IndexUserFields>

 

and within ExamineSettings.config:

<ExamineIndexProviders>
<providers>
<add name="CustomIndexer" type="Examine.LuceneEngine.Providers.SimpleDataIndexer, Examine" dataService="custom.indexers.CustomDataService, custom.indexers" indexTypes="CustomData" />
 </providers>

 

<ExamineSearchProviders defaultProvider="CustomSearcher">
<providers>
<add name="CustomSearcher" type="Examine.LuceneEngine.Providers.LuceneSearcher, Examine" />
</providers>
</ExamineSearchProviders>