0
我正在使用太陽黑子索引和Rspec進行測試的搜索API。太陽黑子在測試期間重新索引擦除開發索引
我有一個測試我的搜索控制器:
context 'when doing a simple search', :type => :request do
let!(:instance_of_my_model) { create(:instance_of_my_model) }
it 'return the correct results' do
MyModel.reindex
# some test code with a GET request
end
end
運行測試,我開始通過空空Solr的服務器:
rake sunspot:solr:start RAILS_ENV=test
運行經過我的測試,我停止Solr的服務器和在開發環境中再次運行它。搜索不再工作。
它再次工作,如果我重新索引:
rake sunspot:reindex
(約1小時,因爲我有10M +項)
這究竟是爲什麼?
有關信息,我/config/sunspot.yml:
development:
solr:
hostname: localhost
port: 8982
log_level: INFO
test:
solr:
hostname: localhost
port: 8981
log_level: WARNING