I had a similar issue and managed to get the connection via POST as explained here.
Create a new SolrStartUp class inheriting from the default one: Here is where you use The PostSolrnConnection
public class PostSolrStartUp: DefaultSolrStartUp
{
protected override ISolrConnection CreateConnection(string serverUrl)
{
SolrConnection basecon = new SolrConnection(serverUrl) { Timeout = SolrContentSearchManager.ConnectionTimeout };
FieldInfo field = typeof(DefaultSolrStartUp).GetField("solrCache", BindingFlags.Instance | BindingFlags.NonPublic);
var basecache = field.GetValue(this);
if (basecache != null)
{
basecon.Cache = (ISolrCache)basecache;
}
PostSolrConnection solrConnection = new PostSolrConnection(basecon, serverUrl);
return solrConnection;
}
}
Create a new Sitecore Initializer and use your start up class
public class InitializeSolrProvider
{
public InitializeSolrProvider()
{
}
public void Process(PipelineArgs args)
{
if (!SolrContentSearchManager.IsEnabled)
{
return;
}
if (!IntegrationHelper.IsSolrConfigured())
{
(new PostSolrStartUp()).Initialize();
return;
}
IntegrationHelper.ReportDoubleSolrConfigurationAttempt(this.GetType());
}
}
Replace the default initializer with yours
<sitecore>
<pipelines>
<initialize>
<processor type="ClearPeople.Sitecore.ContentSearch.SolrProvider.InitializeSolrProvider, ClearPeople.Sitecore" patch:instead="processor[@type='Sitecore.ContentSearch.SolrProvider.Pipelines.Loader.InitializeSolrProvider, Sitecore.ContentSearch.SolrProvider']" />
</initialize>
</pipelines>
</sitecore>
Please, comment any issue you could see with this solution
PostSolrConnection
instead ofSolrConnection
. But Sitecore's Solr integration libraries haveSolrConnection
hard-coded everywhere. So it looks like you can't use POST requests. Well, unless you decompile Sitecore dlls, change them to use the right type, and compile them back. – Dmytro Shevchenko Dec 13 '16 at 22:56