title: Connection refused using Sunspot and Solr in Rails
body: <p>I'm having an issue wherein I get an ECONNREFUSED error when I try to perform a search using sunspot_rails. The gems (sunspot_rails and sunspot_solr) both seem to be installed properly. I'm running version <code>1.3.3</code> and I have the server running correctly.</p>
  
  <p>I've found another post about this, but the post only recommended starting the sunspot solr server. I've definitely done that, but the error persists.</p>
  
  <p>I believe the problem is due to the port the server is on. When I look at the output from <code>RAILS_ENV=development rake sunspot:solr:run</code>, it shows that the server is running on port <code>8983</code>. I've also tried the command <code>RAILS_ENV=production rake sunspot:solr:run</code> with the same effect. </p>
  
  <p>If I examine the <code>sunspot.yml</code> config file, it shows the following:</p>
  
  <pre><code>production:
    solr:
      hostname: localhost
      port: 8983
      log_level: WARNING
  
  development:
    solr:
      hostname: localhost
      port: 8982
      log_level: INFO
  
  test:
    solr:
      hostname: localhost
      port: 8981
      log_level: WARNING
  </code></pre>
  
  <p>Notice that it's <em>supposed</em> to be on port <code>8982</code> for development, but no matter what I do it seems to keep restarting the server on port <code>8983</code>. Any idea how this could be happening?</p>
  
  <p>Thanks!</p>
  
  <p><strong>Update:</strong> I've found a potential cause. In my project folder, the file <code>/solr/conf/scripts.conf</code> contains the following: <code>solr_port=8983</code>. This seems to imply a hardcoded port no matter what Rails environment is active.</p>