dhysong
dhysong

Reputation: 1021

SolrNet Error - Unable to read data from the transport connection: The connection was closed

I'm trying to search a Solr server from a webservice using SolrNet. I set up the connection in the global.asax: Startup.Init<ApartmentDoc>("http://192.168.0.100:8080/solr/");

I'm trying to query the server in a class file via:

var solr = ServiceLocator.Current.GetInstance<ISolrOperations<ApartmentDoc>>();

var apartments = solr.Query(SolrQuery.All, new QueryOptions
{
   ExtraParams = new Dictionary<string, string> {
                    { "defType", "edismax" } , 
                    { "fl", "*,score,_dist_:geodist() " } ,
                    { "bf", "recip(geodist(),1,1000,1000)" } ,
                    { "fq", string.Format("{{!geofilt d={0}}}", radius * 1.609344) } , 
                    { "sfield", "Location" } ,
                    { "pt", string.Format("{0},{1}", centerLat, centerLong) }
                }
    });
return apartments;

The error I'm getting is: Unable to read data from the transport connection: The connection was closed.

I've checked the logs in TomCat, and the request is going through and the results appear to have been returned.

Any ideas why I'm not getting the results back?

Thanks, Drew

Upvotes: 0

Views: 381

Answers (1)

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99730

As the 'rows' parameter wasn't defined in your code, the request is likely timing out from trying to retrieve a large number of documents. As explained in the SolrNet documentation, always define pagination parameters.

Upvotes: 2

Related Questions