Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 326
TiSer Avatar asked Oct 07 '11 12:10

TiSer


2 Answers

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 .

like image 120
Vik Avatar answered Nov 15 '22 11:11

Vik


Just configure the rake task with the test environment:

rake sunspot:solr:run RAILS_ENV=test
like image 44
fro_oo Avatar answered Nov 15 '22 10:11

fro_oo