0
我正在使用sunspot來搜索我的本地數據庫。加入寶石,運行生成的命令,並啓動了Solr的服務器後,我做了以下內容:這個太陽黑子Solr設置有什麼問題?
加入上面我的風格模式,並重新索引(我已經之前創建這篇文章索引,這就是爲什麼我重新索引把它放在這兒)
[email protected] ~/rails_projects/goodsounds.org $ rake sunspot:solr:reindex
[RailsAdmin] RailsAdmin initialization disabled by default. Pass SKIP_RAILS_ADMIN_INITIALIZER=false if you need it.
*Note: the reindex task will remove your current indexes and start from scratch.
If you have a large dataset, reindexing can take a very long time, possibly weeks.
This is not encouraged if you have anywhere near or over 1 million rows.
Are you sure you want to drop your indexes and completely reindex? (y/n)
y
[#######################################] [14/14] [100.00%] [00:00] [00:00] [53.19/s]
然後我嘗試搜索,並得到什麼
1.9.3p392 :003 > Style.search { fulltext 'Monkey' }.results
SOLR Request (10.4ms) [ path=#<RSolr::Client:0x0000000685ab28> parameters={data: fq=type%3AStyle&q=Monkey&fl=%2A+score&qf=full_name_text+brand_name_text&defType=dismax&start=0&rows=30, method: post, params: {:wt=>:ruby}, query: wt=ruby, headers: {"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"}, path: select, uri: http://localhost:8982/solr/select?wt=ruby, open_timeout: , read_timeout: , retry_503: , retry_after_limit: } ]
=> []
但是,等待不應該是有工作,就撿起?
Style.first
Style Load (1.3ms) SELECT "styles".* FROM "styles" LIMIT 1
=> #<Style id: 54, brand_name: "Monkey", full_name "Monkey Chicken", created_at: "2013-02-01 23:25:58", updated_at: "2013-02-16 03:02:16">
這裏有一條線索。我看到「未知領域」爲BRAND_NAME(在Style.rb設置)
嗨,我現在就這樣做了..你怎麼看? – Abram 2013-05-08 08:24:54
這非常奇怪 - 我實際上構建了一個Style模型來匹配上面的,並且它與默認的生成配置一起工作正常。我假設你正在使用Mac或Linux - sunspot_solr通常比PC上的更加壯觀。如果你創建一個新的應用程序,只是其中的樣式模型,並使用'rails g sunspot_rails:install'生成設置是否有效? – mikeryz 2013-05-08 08:47:47
是的,我正在運行薄荷14(Ubuntu的量子) – Abram 2013-05-08 08:48:50