javaeye3/script/search.rb

18 lines
551 B
Ruby

#!/usr/bin/env ruby
ENV['RAILS_ENV'] = 'production'
require File.dirname(__FILE__) + '/../config/environment'
include FullTextSearch
topics = Topic.paginate_search("测试")
topics.each do |topic|
print "score: #{topic.search_score}, id: #{topic.id}, title: "
puts(win32? ? Iconv.iconv("GB18030", "UTF-8", topic.title) : topic.title)
end
blogs = Blog.paginate_search("测试")
blogs.each do |topic|
print "score: #{topic.search_score}, id: #{topic.id}, title: "
puts(win32? ? Iconv.iconv("GB18030", "UTF-8", topic.title) : topic.title)
end