Kyle Kingsbury A Sitecore web development blog!

Configuring Sitecore’s SolrProvider to use SolrPostConnection

C

By default, Sitecore’s ContentSearch Solr implementation is configured to send all requests to Solr using a HTTP GET. For most implementations, this is fine and shouldn’t need to be changed. However, if you are doing very complex queries you’ll quickly run into IIS’s web server query string and URL length limits. You have two options at this point, configure the limits within the web.config absurdly high or change the way Sitecore send’s request to Solr. Since i’ve tried doing option 1 before with no luck, I prefer the latter as the limits for using POST are much, much higher.

Luckily for us with the latest release of Sitecore, the ContentSearch SolrProvider includes a default container with the ability to swap things in and out. If you are running an older version of Sitecore this was a fairly decent amount of work; lucky for you i’ve already built a NuGet package ready for you to use.

Configuring Sitecore to send POST requests instead of GET’s

First up, we need to extend the DefaultSolrStartUp class and override the CreateConnection method to change out the original SolrConnection from SolrNet to return PostSolrConnection implementation.

Next up, we need to create an instance of our SolrPostStartUp class and call the base Initialize method.

And lastly, we need to override Sitecore’s initialize processor with our new processor.

I hope you enjoyed this post!

Add comment

By Kyle Kingsbury
Kyle Kingsbury A Sitecore web development blog!

Recent Posts

Tags