Upgrading a .NET Application with Solr and SolrNet
Today I took the task of updating a .NET application that I’ve had since sometime around 2013.
I created this application with a few people at the time of .NET 4.0 and Solr 4.10, with its corresponding SolrNet.
Today I moved it to Solr 8.4 and with .NET 4.7.
There are a few interesting changes that you need to take into account, which I may expand at some point. But just in case, if you are in the same scenario, here are some upgrade tips for you to consider:
#1 When you move from Solr 4.10 (and older versions) to 8.4, there are some changes to take into account
- The default field is now _text_ and not text
- Some types may have changed
- Default now is managed-schema, not schema.xml
- Some changes are required in solrconfig.xml
So, what I did is downloaded, installed and started a Solr 8.4.
Then I created a core
bin\solr.cmd create -c <name>
Next, I configured Solr so that I do not use schemaless mode. Use this link for more info: Switching from Managed Schema to Manually Edited schema.xml
Don’t forget that besides changing the ClassicIndexSchemaFactory
, you also need to disable schema guessing, which allows unknown fields to be added to the schema during indexing.
Then I indexed some data. This didn’t change much.
Now, a fun one. I have a custom request handler, which wasn’t working. Oh dear, I forgot for a second that the qt parameter no longer works unless you explicitly configure Solr to work.
This is straightforward. Comment out your select request handler, and add the handleSelect attribute to true in the RequestDispatcher node. Like this:
<requestDispatcher handleSelect="false" >
Also, comment out the select requestHandler.
Restart Solr and happy searching!
Hey, you missed to attach the sample code project. Please attach that as well or provide the link if I have missed it.
I have a standalone solr running on basic authentication and HTTPS.
With SolrNet – i am able to achieve basic authentication when running solr on HTTP but when i change to https it throws error – The request was aborted: Could not create SSL/TLS secure channel..
Below are the code snippet -please guide how to achieve both Basic Auth and SSL
//To create connection
var solrConnection = new SolrConnection(solrServerUrl.Trim()) { HttpWebRequestFactory = new BasicAuthHttpWebRequestFactory(_solrUserName, _solrPassword), ServerURL = solrServerUrl.Trim() };
//To check core staus
ISolrCoreAdmin solrCoreAdmin = new SolrCoreAdmin(solrConnection, GetHeaderParser(), GetStatusResponseParser()); var solrCoreStatus = solrCoreAdmin.Status(_solrCoreName);
if (String.IsNullOrEmpty(solrCoreStatus.Name)) { var solrCoreCreate = solrCoreAdmin.Create(_solrCoreName, _solrInstanceDir); }
When trying to execute the line solrCoreAdmin.Status(_solrCoreName) it throws SSL/TLS error.
Please guide me how to implement both HTTPS and Basic Authentication as i cannot find any example or document on how to achieve both.