我真的需要幫助安裝獅身人面像,並得到它。如何配置PostgreSQL或MySQL以使用Sphinx設置數據庫?
我在軌道3上,我遵循以下這組方向:http://freelancing-god.github.com/ts/en/quickstart.html來安裝Sphinx。
思維獅身人面像很容易安裝,因爲它是一個寶石。然而,指南說,我需要安裝獅身人面像和安裝思考獅身人面像(這是真的嗎?)。我檢查了思維獅身人面像的Ryan Bates的railscast,他只安裝了插件並立即開始。
不管怎麼說,我通過安裝MacPorts的獅身人面像和這裏的證明:
...
---> Configuring mysql5
---> Building mysql5
---> Staging mysql5 into destroot
---> Installing mysql5 @5.1.57_0
The MySQL client has been installed.
...
---> Installing sphinx @0.9.9_0+mysql5
---> Activating sphinx @0.9.9_0+mysql5
---> Cleaning sphinx
它自動MYSQL5配置的獅身人面像。我有mySQL和POSTgreSQL。
現在,下一步是rake thinking_sphinx:index
建立在我的用戶模型中的指標,看起來像這樣經過:
define_index do
indexes year
indexes major
indexes books_buy
indexes books_sell
indexes facebook
indexes restaurants
indexes interests
end
然而,rake thinking_sphinx:index
給了我這個:
rake aborted!
Don't know how to build task 'thinking_sphnix:index'
然後
rake aborted!
no such file to load -- sqlite3
所以我想我的數據庫是在sqlite3上配置的依然。所以我換寶石到MySQL和編輯我的database.yml文件看起來像這樣:
# Switched over to mysql
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
development:
adapter: mysql5
encoding: utf8
database: sphinx_development
pool: 5
username: root
password:
socket: /tmp/mysql.sock
test:
adapter: mysql5
encoding: utf8
database: sphinx_test
pool: 5
username: root
password:
socket: /tmp/mysql.sock
production:
adapter: mysql5
encoding: utf8
database: sphinx_production
pool: 5
username: root
password:
socket: /tmp/mysql.sock
,我得到了這些錯誤:
rake aborted!
Please install the mysql5 adapter: `gem install activerecord-mysql5-adapter` (no such file to load -- active_record/connection_adapters/mysql5_adapter)
和
ERROR: Could not find a valid gem 'activerecord-mysql5-adapter' (>= 0) in any repository
ERROR: Possible alternatives: activerecord-jdbcmysql-adapter, activerecord-nulldb-adapter, activerecord-odbc-adapter, activerecord-jdbc-adapter, activerecord-postgis-adapter
Tony-Ngs-MacBook-Air:sample_app TonyNg$ gem install activerecord-nulldb-adapter
任何提示將慷慨和樂於助人。如果能提供幫助,也願意切換到PostgreSQL。謝謝!
所以你決定忽略錯誤信息,告訴你該怎麼做? 「**請安裝mysql5適配器**:'gem install activerecord-mysql5-adapter'」 –
不,我試過了,得到:'錯誤:找不到有效的gem'activerecord-mysql5-adapter'(> 0)在任何存儲庫中 錯誤:可能的替代方案:activerecord-jdbcmysql-adapter,activerecord-nulldb-adapter,activerecord-odbc-adapter,activerecord-jdbc-adapter,activerecord-postgis-adapter ' – Tony
首先,sphinx只支持mysql和postgresql,而不是sqlite3。另外,要驗證您是否安裝了獅身人面像,您是否已在搜索路徑中「搜索」?這就是獅身人面像搜索守護進程。這聽起來像你需要創建你的開發MySQL數據庫,你需要通過mysql提示符來完成。 –