Algolia Index Provider for Sitecore 9.1

Reading Time: 2 minutes

We have been assigned with a task to enable searching and getting back search results for visitors from both Sitecore and old WordPress website. As Algolia was used already with existing WordPress site, we have decided to try out first implementing Algolia search provider for Sitecore. Plan B was to leverage Coveo (as it has extensive support for Sitecore) or build our custom implementation using either Solr or Azure Search search providers.

Luckily for us there was already Sitecore Search Provider for Algolia created by Dmitry Harnitski and you can find it on github. Problem was that the code supported only Sitecore 8 version and we were already on Sitecore 9.1.

I have therefore forked his repository and created my own Sitecore Index Provider for Algolia for Sitecore 9.1+. I am using Sitecore Index Provider as name of this on purpose as it’s not full blown Search Provider as are OOTB ones for Solr or Azure Search. I left name of repository (Search provider) as Dmitry used it. You cannot effectively search using this provider only index items from Sitecore to Algolia. Lots of methods that are needed for searching are throwing “Not implemented” exceptions. This was already in Dmitry’s repository like that. It actually makes sense for Algolia as Algolia has really cool Javascript (similarly to Coveo) that you can use in your views to do searching. It can be also used to combine search results for different queries quite easily.

You can find my implementation for Sitecore 9.1+ in this sitecore91 branch on my github: https://github.com/chorpo/Sitecore.Algolia/tree/sitecore91

I have made some significant changes:

  • .NET Target Framework bumped to 4.7.2
  • Sitecore referenced nuget packages bumped to Sitecore 9.1 versions
  • Removed completely Algolia.Search project and replaced it with 5.2.1 version of Algolia.Search nuget which makes solution much simpler and future proof; I have used version 5.2.1 as it’s the last to use Newtonsoft.JSON 11.0.2 so same as Sitecore 9.1 uses not to have version conflicts
  • Removed switches for old Sitecore 8 versions as needed for Sitecore 9.1
  • Tests project also uses nuget references and I have bumped versions of used nuget packages
  • Because of some compatibility issues with FluentAssertions I had to unload Tests project from solution for now (will investigate further)

Next steps:

  • Fix issues in Tests project
  • Clean up and refactor code as Stylecop shows more than 200 warnings

Enjoy and contribute!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.