sunspot_rails gem - " Errno:: ECONNREFUSED (Connection refused - connect (2)) "
Asked Answered
H

4

19

I use gem sunspot_rails https://github.com/outoftime/sunspot I did everything according to the instructions on http://railscasts.com/episodes/278-search-with-sunspot, but get an error

Errno:: ECONNREFUSED (Connection refused - connect (2)): app/controllers/books_controller.rb: 7: in `index '

code from books_controller.rb

  def index
    @search = Book.search do
      fulltext params[:search]
    end
    @books = @search.results
  end

what it can be?

Heterogeneity answered 7/10, 2011 at 12:36 Comment(0)
N
29

Have you started the Solr server?

rake sunspot:solr:start

If not than start the solr server first

And If yes than try

rake sunspot:solr:run

Hope this will help .

Nagano answered 7/10, 2011 at 12:48 Comment(3)
yeap, I ran rake sunspot:solr:start When I try to run rake sunspot:solr:run I had: No such file or directory - java -Djetty.port=8982 -Dsolr.data.dir=/home/sergey/Sites/bookoid/solr/data/development -Dsolr.solr.home=/home/sergey/Sites/bookoid/solr -Djava.util.logging.config.file=/tmp/logging.properties20111007-11769-pt9x4a -jar start.jarHeterogeneity
@TiSer It looks like you may not have java installed. Try installing Java and see if that helps.Dorrisdorry
nice awnser, this caused me some headace! tx!Kenrick
T
9

Just configure the rake task with the test environment:

rake sunspot:solr:run RAILS_ENV=test
Thea answered 28/11, 2011 at 23:46 Comment(0)
P
0

Make sure your rails app is looking for the solr server on the correct port.

Panda answered 15/11, 2011 at 20:38 Comment(0)
H
0

Make sure that Java Runtime Environment already installed.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Husbandman answered 20/3, 2013 at 10:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.