Sitefinity Toolkit: Search Index Providers

By in
No comments

I’d like to apologize for the delay in continuing my Sitefinity Toolkit series. Wednesday I was out sick, and have spent the rest of this week catching up. However I didn’t want the weekend to pass without adding at least something, so here is a quick rundown on using the new Search Index Providers provided by the toolkit.

A lot of this work is based on the Sitefinity Index and Search Events post I wrote last year, but in addition to indexing the Events Module, it has been extended to include support for Latest News, which is any news that has been published, but not yet expired, as well as items from your Generic Content Module.

Important Note as with all the other features in the current 1.0 version of the toolkit, only the Default Provider of each module is indexed, and no settings or preferences can be set for the indexes. In a future release I hope to include configuration and provider selection. If you would like to help support future releases, please consider making a donation to expanding my music studio (see sidebar).

Installation

As always, be sure to download the sitefinity toolkit and extract it to your bin directory, making sure to get the correct version for your sitefinity installation.

Depending on which index providers you want to use, copy any combination of the following to your web.config file:

<telerik>
    <search>
        <indexClients>
            <add name="PageIndex" type="Telerik.Cms.Search.PageIndexProvider, Telerik.Cms" settingsControl="Telerik.Cms.Web.UI.PageIndexSettings, Telerik.Cms" viewSettingsControl="Telerik.Cms.Web.UI.SearchViewControl, Telerik.Cms" description="Provides indexing services for CMS Pages." />
            <add name="LatestNewsIndex" type="SelArom.Net.Sitefinity.IndexProviders.LatestNews.LatestNewsIndexProvider, SelArom.Net.Sitefinity" settingsControl="SelArom.Net.Sitefinity.IndexProviders.LatestNews.SettingsControl" viewSettingsControl="SelArom.Net.Sitefinity.IndexProviders.LatestNews.ViewControl" description="Provides indexing for current news." />
            <add name="EventIndex" type="SelArom.Net.Sitefinity.IndexProviders.Events.EventIndexProvider, SelArom.Net.Sitefinity" settingsControl="SelArom.Net.Sitefinity.IndexProviders.Events.SettingsControl, SelArom.Net.Sitefinity" viewSettingsControl="SelArom.Net.Sitefinity.IndexProviders.Events.ViewControl, SelArom.Net.Sitefinity" description="Provides indexing for events." />
            <add name="GenericContentIndex" type="SelArom.Net.Sitefinity.IndexProviders.GenericContent.GenericContentIndexProvider, SelArom.Net.Sitefinity" settingsControl="SelArom.Net.Sitefinity.IndexProviders.GenericContent.SettingsControl, SelArom.Net.Sitefinity" viewSettingsControl="SelArom.Net.Sitefinity.IndexProviders.GenericContent.ViewControl, SelArom.Net.Sitefinity" description="Provides indexing for events." />
        </indexClients>
    </search>
</telerik>

Like the Sitemap Generator feature, it is necessary for you to specify the url “prefix” (see previous post for more information) for the “details” page of each module in your appSettings node.

<appSettings>
    <add key="NewsUrl" value="/news/details" />
    <add key="EventsUrl" value="/events/calendar/details" />
    <add key="MyGCProviderUrl" value="/mygcprovider/details" />
</appSettings>

Remember the key is created from the name of each provider followed by “Url”. In the above, my events provider is “Events”, my Generic Content Module provider is “MyGCProvider”, and so on.

Now you need to go to your site Sitefinity Administration page at sitefinity/admin/CmsAdmin/Services.aspx?service=Search. Either create a new index or select an existing one. The index providers will be available for you to select at the bottom:

sitefinitytoolkit_indexproviders

As you can see, there are currently no options in any of these custom providers. Future releases will hopefully allow to set the web.config settings here, as well as select which provider you wish to use, but for now, this provides you with basic indexing and searching of your Events, Active News, and Generic Content.

Save your changes, then start indexing; you’re done!

Let me know if I’ve missed anything, or if you have any comments or suggestions, please email me. If you enjoy my work, I would kindly appreciate any donation to help expand my music studio. See the sidebar for more details.

The following two tabs change content below.

selaromdotnet

Senior Developer at iD Tech
Josh loves all things Microsoft and Windows, and develops solutions for Web, Desktop and Mobile using the .NET Framework, Azure, UWP and everything else in the Microsoft Stack. His other passion is music, and in his spare time Josh spins and produces electronic music under the name DJ SelArom. His other passion is music, and in his spare time Josh spins and produces electronic music under the name DJ SelArom.