我試圖添加搜索功能,使用Sunspot_Solr一個簡單的應用程序,但是,連接不斷被拒絕。太陽黑子Solr連接拒絕
下面是結果我從錯誤頁面獲得:
Showing /Users/danieluribe/code/other/shouter2/app/views/searches/_search.html.erb where line #2 raised:
Connection refused - {:data=>"fq=type%3AShout&start=0&rows=30&q=*%3A*", :method=>:post, :params=>{:wt=>:ruby}, :query=>"wt=ruby", :headers=>{"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"}, :path=>"select", :uri=>#<URI::HTTP http://localhost:8983/solr/development/select?wt=ruby>, :open_timeout=>nil, :read_timeout=>nil, :retry_503=>nil, :retry_after_limit=>nil}
Extracted source (around line #11):
def shouts
# Shout.text_shouts.where(content_id: text_shouts)
Shout.search do
fulltext @term
end.results
end
Trace of template inclusion: app/views/searches/show.html.erb
我已經添加了兩個Sunspot_Solr和Sunspot_Rails寶石。我繼續運行在config文件夾中創建Sunspot.yml文件的generator。
錯誤指向我的標題爲Search.rb的模型文件。以下是部分上面的完整文件參考,刪除了註釋。
class Search
include ActiveModel::Conversion
attr_reader :term
def initialize options =()
@term = options.fetch(:term, "")
end
def shouts
Shout.search do <--- Error points here
fulltext @term
end.results
end
end
我繼續用耙任務啓動Sunspot_Solr。然後我進入控制檯重新編制我的數據庫。我也跟着一些在這裏回答的問題,並改變了港口,無濟於事。
會有人知道這個問題可能是什麼?
可以添加'Sunspot.config.solr.url =的「http://本地主機:8983/solr''到'config/production.rb' –