Windows 7中的acts_as_ferret错误

时间:2011-12-17 19:06:05

标签: ruby-on-rails

我正在尝试在windows7中安装acts_as_ferret但是我遇到了错误

使用act-as-taggable-on(2.1.1)

Installing jk-ferret (0.11.8.3) with native extensions C:/RailsInstaller/Ruby1.9
.2/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in bui
ld_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::Ex
tensionBuildError)

        C:/RailsInstaller/Ruby1.9.2/bin/ruby.exe extconf.rb

创建Makefile

我的宝石文件包含在gemlist

之后
gem 'rails', '3.0.1'
gem 'mysql', '2.8.1'
gem 'contacts', '1.2.4'
gem 'hpricot'
gem 'db_populate'
gem 'gravtastic'
gem 'acts_as_ferret'
gem 'packet'
gem 'rmagick','2.9.1'
gem 'fastercsv'
gem 'will_paginate','3.0.pre2'
gem 'aws-s3', :require => 'aws/s3'
gem 'thinking-sphinx', '2.0.0', :require => 'thinking_sphinx'
#gem 'ckeditor', :git => 'git://github.com/galetahub/rails-ckeditor.git', :branch => 'rails3'
#gem 'ckeditor', '3.4.0.pre', :path => 'vendor/ckeditor-3.4.0.pre'
gem 'ckeditor', '3.5.4', :path => 'vendor/ckeditor-3.5.4'
gem 'mongrel'
gem 'acts_as_tree'
gem 'acts-as-taggable-on'
gem 'seed-fu'
gem 'RedCloth'
gem 'ryanb-acts-as-list'
gem 'tzinfo'
gem 'authlogic'
gem 'oauth'
gem 'authlogic-oauth'
gem "paperclip", "~> 2.3"
gem 'rails-erd'
gem 'crypt', :require => 'crypt/blowfish'
gem "pdfkit", :git => "https://github.com/huerlisi/PDFKit.git"
gem 'ssl_requirement'

任何人都可以向我推荐解决方案。

1 个答案:

答案 0 :(得分:0)

好。这可能不是您问题的直接解决方案。但是,你可以在其他地方寻找在轨道3中搜索。

来自acts_as_ferret自述文件

aaf is not yet ready for Rails3. Feel free to submit patches!

Rails 3 :More Like this no longer works for unsaved records (test fails in 
content_test.rb test_more_like_this_new_record)

Rails 3: Sorting does not work - causes failure in sorting test & pagination test.

它也没有得到很好的维护。如果你这样做搜索“acts_as_ferret windows”。你会看到“buggy”这个词很多。

因此。怎么做

<强> 1。进行简单的搜索

这是针对模型Post的。 文章/ index.html.erb

<%= form_tag posts_path, :method => 'get' do %>
  <p>
    <%= text_field_tag :search, params[:search] %>
    <%= submit_tag "Search", :name => nil %>
  </p>
<% end %>

posts_controller.rb

def index
  @posts = Post.search(params[:search])
end

models / post.rb

def self.search(search)
  if search
    where('title LIKE ? OR text LIKE ?', "%#{search}%", "%#{search}%" )
  else
    scoped
  end
end

<强> 2。进行全文搜索

在全文搜索中,您将获得普通网络搜索引擎等功能。 你可以做“测试+工作”等等。

如果您确实需要全文搜索,请查看。

Sphinx

Sunspot

elasticsearch

Episode 120: Thinking Sphinx (revised)

Episode 278: Searching with Sunspot

Episode 307: ElasticSearch Part 2 (pro)

Episode 306:Elasticsearch Part 1