2013-07-24 57 views
1

我最近將我的rails 3.2應用升級到4.0,並將Ruby升級到2.0。我現在有問題現在正在運行太陽黑子。它會正確啓動,但當我導航到太陽黑子正在處理的搜索頁面時,會引發以下錯誤。我環顧四周,但找不到任何東西。用Sunspot/Solr升級到Rails 4時出現問題

感謝您的幫助。

服務器錯誤

RSolr::Error::Http - 404 Not Found Error: Not Found Request Data: "fq=type%3AGear&start=0&rows=30&facet=true&f.category_name_sms.facet.mincount=1&facet.field=category_name_sms&facet.field=sub_category_name_sms&facet.field=state_s&facet.field=city_s&facet.field=price_s&f.sub_category_name_sms.facet.mincount=1&f.state_s.facet.mincount=1&f.city_s.facet.mincount=1&f.price_s.facet.mincount=1&q=%2A%3A%2A" Backtrace: /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in adapt_response' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in execute' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in send_and_receive' /usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:16:in block in send_and_receive_with_as_instrumentation' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in block in instrument' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in instrument' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in instrument' /usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:15:in send_and_receive_with_as_instrumentation' (eval):2:in post' /usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot/search/abstract_search.rb:45:in execute' /usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/searchable.rb:358:in `solr_execute_search''

SOLR開發日誌錯誤

Jul 30, 2013 11:48:46 PM org.apache.solr.servlet.SolrDispatchFilter init 
INFO: SolrDispatchFilter.init() 
Jul 30, 2013 11:48:46 PM org.apache.solr.core.SolrResourceLoader locateSolrHome 
INFO: JNDI not configured for solr (NoInitialContextEx) 
Jul 30, 2013 11:48:46 PM org.apache.solr.core.SolrResourceLoader locateSolrHome 
INFO: using system property solr.solr.home: /Users/dave/rails_projects/EquiptMe/solr 
Jul 30, 2013 11:48:46 PM org.apache.solr.core.CoreContainer$Initializer initialize 
INFO: looking for solr.xml: /Users/dave/rails_projects/EquiptMe/solr/solr.xml 
Jul 30, 2013 11:48:46 PM org.apache.solr.core.CoreContainer <init> 
INFO: New CoreContainer 567038057 
Jul 30, 2013 11:48:46 PM org.apache.solr.core.CoreContainer$Initializer initialize 
INFO: no solr.xml file found - using default 
Jul 30, 2013 11:48:46 PM org.apache.solr.core.CoreContainer load 
INFO: Loading CoreContainer using Solr Home: '/Users/dave/rails_projects/EquiptMe/solr/' 
Jul 30, 2013 11:48:46 PM org.apache.solr.core.SolrResourceLoader <init> 
INFO: new SolrResourceLoader for directory: '/Users/dave/rails_projects/EquiptMe/solr/' 
Jul 30, 2013 11:48:46 PM org.apache.solr.handler.component.HttpShardHandlerFactory getParameter 
INFO: Setting socketTimeout to: 0 
Jul 30, 2013 11:48:46 PM org.apache.solr.handler.component.HttpShardHandlerFactory getParameter 
INFO: Setting urlScheme to: http:// 
Jul 30, 2013 11:48:46 PM org.apache.solr.handler.component.HttpShardHandlerFactory getParameter 
INFO: Setting connTimeout to: 0 
Jul 30, 2013 11:48:46 PM org.apache.solr.handler.component.HttpShardHandlerFactory getParameter 
INFO: Setting maxConnectionsPerHost to: 20 
Jul 30, 2013 11:48:46 PM org.apache.solr.handler.component.HttpShardHandlerFactory getParameter 
INFO: Setting corePoolSize to: 0 
Jul 30, 2013 11:48:46 PM org.apache.solr.handler.component.HttpShardHandlerFactory getParameter 
INFO: Setting maximumPoolSize to: 2147483647 
Jul 30, 2013 11:48:46 PM org.apache.solr.handler.component.HttpShardHandlerFactory getParameter 
INFO: Setting maxThreadIdleTime to: 5 
Jul 30, 2013 11:48:46 PM org.apache.solr.handler.component.HttpShardHandlerFactory getParameter 
INFO: Setting sizeOfQueue to: -1 
Jul 30, 2013 11:48:46 PM org.apache.solr.handler.component.HttpShardHandlerFactory getParameter 
INFO: Setting fairnessPolicy to: false 
Jul 30, 2013 11:48:46 PM org.apache.solr.client.solrj.impl.HttpClientUtil createClient 
INFO: Creating new http client, config:maxConnectionsPerHost=20&maxConnections=10000&socketTimeout=0&connTimeout=0&retry=false 
Jul 30, 2013 11:48:46 PM org.apache.solr.core.CoreContainer load 
INFO: Registering Log Listener 
Jul 30, 2013 11:48:46 PM org.apache.solr.core.CoreContainer create 
INFO: Creating SolrCore 'collection1' using instanceDir: /Users/dave/rails_projects/EquiptMe/solr/collection1 
Jul 30, 2013 11:48:46 PM org.apache.solr.core.SolrResourceLoader <init> 
INFO: new SolrResourceLoader for directory: '/Users/dave/rails_projects/EquiptMe/solr/collection1/' 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.SolrConfig <init> 
INFO: Using Lucene MatchVersion: LUCENE_41 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.SolrConfig <init> 
INFO: Loaded SolrConfig: solrconfig.xml 
Jul 30, 2013 11:48:47 PM org.apache.solr.schema.IndexSchema readSchema 
INFO: Reading Solr Schema 
Jul 30, 2013 11:48:47 PM org.apache.solr.schema.IndexSchema readSchema 
INFO: Schema name=sunspot 
Jul 30, 2013 11:48:47 PM org.apache.solr.schema.IndexSchema readSchema 
INFO: default search field in schema is text 
Jul 30, 2013 11:48:47 PM org.apache.solr.schema.IndexSchema readSchema 
INFO: query parser default operator is AND 
Jul 30, 2013 11:48:47 PM org.apache.solr.schema.IndexSchema readSchema 
INFO: unique key field: id 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.SolrCore <init> 
INFO: [collection1] Opening new SolrCore at /Users/dave/rails_projects/EquiptMe/solr/collection1/, dataDir=/Users/dave/rails_projects/EquiptMe/solr/data/development/ 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.SolrCore <init> 
INFO: JMX monitoring not detected for core: collection1 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.SolrCore initDirectoryFactory 
INFO: solr.NRTCachingDirectoryFactory 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.CachingDirectoryFactory get 
INFO: return new directory for /Users/dave/rails_projects/EquiptMe/solr/data/development forceNew: false 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.SolrCore getNewIndexDir 
INFO: New index directory detected: old=null new=/Users/dave/rails_projects/EquiptMe/solr/data/development/index/ 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.CachingDirectoryFactory get 
INFO: return new directory for /Users/dave/rails_projects/EquiptMe/solr/data/development/index forceNew: false 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /select: solr.SearchHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /query: solr.SearchHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /get: solr.RealTimeGetHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /update: solr.UpdateRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /update/json: solr.JsonUpdateRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /update/csv: solr.CSVRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: adding lazy requestHandler: solr.extraction.ExtractingRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /update/extract: solr.extraction.ExtractingRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: adding lazy requestHandler: solr.FieldAnalysisRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /analysis/field: solr.FieldAnalysisRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: adding lazy requestHandler: solr.DocumentAnalysisRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /analysis/document: solr.DocumentAnalysisRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /admin/ping: solr.PingRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /debug/dump: solr.DumpRequestHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /replication: solr.ReplicationHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /mlt: solr.MoreLikeThisHandler 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig 
INFO: created /admin/: solr.admin.AdminHandlers 
Jul 30, 2013 11:48:47 PM org.apache.solr.handler.loader.XMLLoader init 
INFO: xsltCacheLifetimeSeconds=60 
Jul 30, 2013 11:48:47 PM org.apache.solr.handler.loader.XMLLoader init 
INFO: xsltCacheLifetimeSeconds=60 
Jul 30, 2013 11:48:47 PM org.apache.solr.handler.loader.XMLLoader init 
INFO: xsltCacheLifetimeSeconds=60 
Jul 30, 2013 11:48:47 PM org.apache.solr.search.SolrIndexSearcher <init> 
INFO: Opening [email protected] main 
Jul 30, 2013 11:48:47 PM org.apache.solr.update.CommitTracker <init> 
INFO: Hard AutoCommit: if uncommited for 15000ms; 
Jul 30, 2013 11:48:47 PM org.apache.solr.update.CommitTracker <init> 
INFO: Soft AutoCommit: if uncommited for 5000ms; 
Jul 30, 2013 11:48:47 PM org.apache.solr.handler.component.SpellCheckComponent inform 
INFO: Initializing spell checkers 
Jul 30, 2013 11:48:47 PM org.apache.solr.spelling.DirectSolrSpellChecker init 
INFO: init: {name=default,field=name,classname=solr.DirectSolrSpellChecker,distanceMeasure=internal,accuracy=0.5,maxEdits=2,minPrefix=1,maxInspections=5,minQueryLength=4,maxQueryFrequency=0.01} 
Jul 30, 2013 11:48:47 PM org.apache.solr.handler.component.SpellCheckComponent inform 
INFO: No queryConverter defined, using default converter 
Jul 30, 2013 11:48:47 PM org.apache.solr.handler.ReplicationHandler inform 
INFO: Commits will be reserved for 10000 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.SolrCore registerSearcher 
INFO: [collection1] Registered new searcher [email protected] main{StandardDirectoryReader(segments_1:1)} 
Jul 30, 2013 11:48:47 PM org.apache.solr.core.CoreContainer registerCore 
INFO: registering core: collection1 
Jul 30, 2013 11:48:47 PM org.apache.solr.servlet.SolrDispatchFilter init 
INFO: user.dir=/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_solr/solr 
Jul 30, 2013 11:48:47 PM org.apache.solr.servlet.SolrDispatchFilter init 
INFO: SolrDispatchFilter.init() done 

創業板的使用

gem 'sunspot_solr', github: 'sunspot/sunspot', branch: 'master' 
gem 'sunspot_rails', github: 'sunspot/sunspot', branch: 'master' 

錯誤日誌中運行時重新索引

RSolr::Error::Http - 404 Not Found 
Error:  Not Found 

Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Gear</query></delete>" 

Backtrace: /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation' 
(eval):2:in `post' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:67:in `update' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:131:in `delete_by_query'/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:268:in `adapt_response' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:175:in `execute' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:161:in `send_and_receive' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation' 
(eval):2:in `post' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:67:in `update' 
/usr/local/rvm/gems/ruby-2.0.0-p247/gems/rsolr-1.0.9/lib/rsolr/client.rb:131:in `delete_by_query' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot/indexer.rb:57:in `remove_all' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot/session.rb:181:in `block in remove_all' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot/session.rb:181:in `each' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot/session.rb:181:in `remove_all' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in `method_missing' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot.rb:464:in `remove_all' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/searchable.rb:183:in `solr_remove_all_from_index' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/searchable.rb:202:in `solr_reindex' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/tasks.rb:68:in `block (3 levels) in <top (required)>' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot/class_set.rb:16:in `each' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot/lib/sunspot/class_set.rb:16:in `each' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bundler/gems/sunspot-5488725cb258/sunspot_rails/lib/sunspot/rails/tasks.rb:67:in `block (2 levels) in <top (required)>' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval' 
/usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>' 
+0

檢查solrconfig.xml是否存在 –

回答

2

所以我最終解決了這個問題,採用以下方法。

  1. 首先我卸載了太陽黑子和SOLR的所有版本。
  2. 接下來,我用的寶石 'sunspot_rails' 寶石 'sunspot_solr'
  3. 重新安裝太陽黑子我加入solr.rake應用/ lib目錄/任務
namespace :sunspot do 
    namespace :solr do 
    desc 'Start the Solr instance' 
    task :start => :environment do 
     case RUBY_PLATFORM 
     when /w(in)?32$/, /java$/ 
      abort("This command is not supported on #{RUBY_PLATFORM}. " + 
      "Use rake sunspot:solr:run to run Solr in the foreground.") 
    end 

    if defined?(Sunspot::Rails::Server) 
    Sunspot::Rails::Server.new.start 
    else 
    Sunspot::Solr::Server.new.start 
    end 
    puts "Successfully started Solr ..." 
end 

desc 'Run the Solr instance in the foreground' 
task :run => :environment do 
    if defined?(Sunspot::Rails::Server) 
    Sunspot::Rails::Server.new.run 
    else 
    Sunspot::Solr::Server.new.run 
    end 
end 

desc 'Stop the Solr instance' 
task :stop => :environment do 
    case RUBY_PLATFORM 
    when /w(in)?32$/, /java$/ 
    abort("This command is not supported on #{RUBY_PLATFORM}. " + 
      "Use rake sunspot:solr:run to run Solr in the foreground.") 
    end 

    if defined?(Sunspot::Rails::Server) 
    Sunspot::Rails::Server.new.stop 
    else 
    Sunspot::Solr::Server.new.stop 
    end 
    puts "Successfully stopped Solr ..." 
end 

task :reindex => :"sunspot:reindex" 
end 
end 

它的工作之後。希望這有助於某人。

+0

對於第2步,如何安裝「gem'sunspot_rails'gem'sunspot_solr'」?你能給出確切的命令嗎? –

+0

@AaronHenderson我認爲他的意思是從gem文件安裝Bundle –

0

你開始什麼參數與太陽黑子Solr的服務器?我猜你試圖更新到Solr4(collection1出現在Solr4中)並且目錄佈局錯誤。

在Solr 3中,配置文件位於solr home下的conf目錄中。在Solr4中,您可以再獲得一個收藏級別,默認名稱爲collection1

如果我是正確的,你可能需要創建在您的家子目錄與collection1,並在其移動的conf和其他目錄。

+0

我使用命令「bundle exec rake sunspot:solr:start」啓動它。從Gem頁面https://github.com/sunspot/sunspot – DaveG

+0

我創建了一個collection1文件夾並將文件從conf移動到了collection1文件夾,但它仍然通過了錯誤 – DaveG

+0

您確定它正在一起看正確的路徑?你在錯誤信息中獲得路徑還是將它設置在某處?您可能需要使用truss/strace命令的一些變體來檢查它的實際位置。或者按照GitHub上的文檔,按照正確的路徑顯式啓動Solr: ** sunspot-solr start - [-d/path/to/data/directory] ​​[-b ip4_address] [-p port] [-s path/to/solr/home] [--pid-dir = path/to/pid/dir] ** –