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 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀