I am in process of upgrading Sitecore from 8.2 to 10 and also Solr.

SolrSearchWithSpatialContext was implemented by previous team but looks like this code is outdated now and there has been no update.


Basically this class is inherited from SolrSearchContext.

        public SolrSearchWithSpatialContext(SolrSearchIndex index,
            SearchSecurityOptions options = SearchSecurityOptions.EnableSecurityCheck)
            : base(index, index.Locator.GetInstance<ILinqToIndexFactory>() , options)
            Assert.ArgumentNotNull(index, "index");
            Assert.ArgumentNotNull(options, "options");
            _contentSearchSettings = index.Locator.GetInstance<IContentSearchConfigurationSettings>();

In the new version, an additional parameter,ILinqToIndexFactory ,has been introduced for instantiating SolrSearchContext

I am not able to figure out how to resolve this parameter. I tried few different things but no success and there is hardly any documentation available around this.

I tried passing index.Locator.GetInstance<ILinqToIndexFactory>() but then it throws exception saying Service Sitecore.ContentSearch.Abstractions.Factories.ILinqToIndexFactory was not registered in container

Please if anyone can help. Thanks in advance.

1 Answer 1


Spatial search is supported by Sitecore out-of-the-box starting from version 9.0 so no additional modules or custom providers are required. See documentation about Sitecore spatial search here.

You can remove all code related to the custom search context and instead use standard search functionality on your upgraded Sitecore 10 website. For example, this is how radius search can be implemented:

using (var context = ContentSearchManager.GetIndex(indexName).CreateSearchContext())
       var queryable = context.GetQueryable<SearchResultItem>()
       .WithinRadius (s => s.Location, new Coordinate (lat, lng), radius);           
       var results = queryable.ToList();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.