Solr is a very powerful search provider that covers almost every feature that you would think of. Geographical search is one of the great features that Solr implemented really nicely by providing spatial indexes, query filters and sorting by distance. Unfortunately, the default Solr provider in Sitecore doesn’t utilise the spatial search feature in Solr. So, I’ve decided to build this small project to extend the existing provider. Thanks to @aokour86 (The author of the Sitecore spatial provider for Lucene) and to @herskinduk for their help and guidance.
Here is the installation guide and examples of how to use the extended provider.
- Download the “Solr Search Support” package from the market place.
- Login to Sitecore (v 7.0+) and install the package via the “Installation Wizard”
- At the last step of the installation wizard, choose to restart the Sitecore server.
- Edit the /App_Config/Include/Sitecore.ContentSearch.Solr.Indexes.config to change the index type from
- Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider to Sitecore.ContentSearch.Spatial.Solr.Provider.SolrSearchIndexWithSpatial, Sitecore.ContentSearch.Spatial.Solr on the master, web and core indexes. E.g the web index should look like
<index id="sitecore_web_index" type="Sitecore.ContentSearch.Spatial.Solr.Provider.SolrSearchIndexWithSpatial, Sitecore.ContentSearch.Spatial.Solr"> ...</index>
- Edit the Solr Schema.xml and add the following dynamic field
<dynamicField name="*_rpt" type="location_rpt" indexed="true" stored="true" />