jiyanliang 2009-11-27 21:12
浏览 323
已采纳

创建索引问题:为什么我的rake ts:index无法执行

为什么运行了git clone git://github.com/freelancing-god/thinking-sphinx.git vendor/plugins/thinking_sphinx安装了 thinking_sphinx还是无法执行ts:index呢
总是报:
quoteD:\zsb>rake thinking_sphinx:index INDEX_ONLY=true
(in D:/zsb)
rake aborted!
Could not find RubyGem rails (>= 0.0.0)
D:/zsb/rakefile:4
(See full trace by running task with --trace)[/quote]
我的rakefile文件如下
quote# Add your own tasks in files placed in lib/tasks ending in .rake,

for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'thinking_sphinx'
require 'thinking_sphinx/tasks'
require 'tasks/rails'[/quote]
我的参考文章为http://www.iteye.com/topic/431217
[b]问题补充:[/b]
太失败了 没装rails
装了之后执行 出现下面的问题
D:\zsb>rake thinking_sphinx:index (in D:/zsb)
rake aborted!
no such file to load -- thinking_sphinx
D:/zsb/rakefile:10
(See full trace by running task with --trace)

我已经吧thinking_sphinx安装到vendor\plugins了啊

[b]问题补充:[/b]
非常不错 要关门了 明天结贴啊 呵呵 :idea:
[b]问题补充:[/b]
非常感谢 再请教一个问题,好像是:config的问题

quoteD:\zsb>rake thinking_sphinx:index --trace
(in D:/zsb)
** Invoke thinking_sphinx:index (first_time)
** Invoke thinking_sphinx:app_env (first_time)
** Execute thinking_sphinx:app_env
** Invoke environment (first_time)
** Execute environment
rake aborted!
can't convert Hash into String
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:300:in match'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:300:in
parse'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:238:in initialize'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:237:in
collect'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:237:in initialize'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:29:in
new'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/version.rb:29:in initialize'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:234:in
new'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:234:in activate'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:76:in
active_gem_with_options'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:50:in gem'
D:/zsb/config/../config/environment.rb:69
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_re
quire'[/quote]

我的gem配置:
quote

Be sure to restart your web server when you modify this file.

Uncomment below to force Rails into production mode when

you don't control web/app server and can't set it the proper way

ENV['RAILS_ENV'] ||= 'production'

Specifies gem version of Rails to use when vendor/rails is not present

#RAILS_GEM_VERSION = '1.2.5' unless defined? RAILS_GEM_VERSION

Bootstrap the Rails environment, frameworks, and default configuration

require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence over those specified here

# Skip frameworks you're not going to use (only works if using vendor/rails)
# config.frameworks -= [ :action_web_service, :action_mailer ]

# Only load the plugins named here, by default all plugins in vendor/plugins are loaded
# config.plugins = %W( exception_notification ssl_requirement )

# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )

# Force all environments to use the same logger level
# (by default production uses :info, the others :debug)
# config.log_level = :debug

# Use the database for sessions instead of the file system
# (create the session table with 'rake db:sessions:create')
# config.action_controller.session_store = :active_record_store
config.action_controller.perform_caching = true

# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql

# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector

# Make Active Record use UTC-base instead of local time
# config.active_record.default_timezone = :utc

# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end

# See Rails::Configuration for more options

#确保一个汉字占一个字符
require 'jcode'
$KCODE = 'u'
end

Add new mime types for use in respond_to blocks:

Mime::Type.register "text/richtext", :rtf

Mime::Type.register "application/x-mobile", :mobile

Include your application configuration below

#Time::DATA_FORMATS[:due_time]="%B %d on %I:%M %P"
RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", "daily")

:config.gem(
'freelancing-god-thinking-sphinx',
:lib => 'thinking_sphinx',
:version => '1.2.0'
)
quote]
[b]问题补充:[/b]
thinking sphinx的gem已经安装了

下面这个是在environment.rb中的配置

'freelancing-god-thinking-sphinx',
:lib => 'thinking_sphinx',
:version => '1.2.0'
) [/quote]

在使用th:index的命令时候还是报错
can't convert Hash into String

  • 写回答

3条回答 默认 最新

  • Hooopo 2009-11-27 21:59
    关注

    看错误提示就知道你没装rails…
    不知道有没有gem;你安装成插件require找不到的…除非你把rails环境加载…

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛