Skip to content

Commit

Permalink
Replaced ferret with thinking sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
redinger committed Jan 30, 2009
1 parent 3fd8772 commit 0507fd7
Show file tree
Hide file tree
Showing 449 changed files with 10,297 additions and 79,729 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
db/*.db
db/*.sqlite3
db/schema.rb
db/sphinx/development
log/*.log
log/*.pid
tmp
config/database.yml
config/*.sphinx.conf
index
public/system
public/javascripts/less_routes.js
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ def search_results
else
p = []
end
@results = Profile.search((p.delete(:q) || ''), p).paginate(:page => @page, :per_page => @per_page)
@results = Profile.search_results((p.delete(:q) || ''), :page => @page, :per_page => @per_page)
end
end
2 changes: 1 addition & 1 deletion app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ def search_results
else
p = []
end
@results = Profile.search((p.delete(:q) || ''), p).paginate(:page => @page, :per_page => @per_page)
@results = Profile.search_results((p.delete(:q) || ''), :page => @page, :per_page => @per_page)
end
end
13 changes: 7 additions & 6 deletions app/models/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ class Profile < ActiveRecord::Base
#Forums
has_many :forum_posts, :foreign_key => 'owner_id', :dependent => :destroy

acts_as_ferret :fields => [ :location, :f, :about_me ], :remote=>true
define_index do
indexes location, about_me, first_name, last_name
indexes user.login, :as => :login
set_property :min_prefix_len => 3, :morphology => false
end

file_column :icon, :magick => {
:versions => {
Expand Down Expand Up @@ -184,11 +188,8 @@ def can_send_messages



def self.search query = '', options = {}
query ||= ''
q = '*' + query.gsub(/[^\w\s-]/, '').gsub(' ', '* *') + '*'
options.each {|key, value| q += " #{key}:#{value}"}
arr = find_by_contents q, :limit=>:all
def self.search_results query = '', options = {}
arr = self.search(query)
logger.debug arr.inspect
arr
end
Expand Down
2 changes: 0 additions & 2 deletions config/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
config.gem 'colored', :version=> '1.1'
config.gem 'youtube-g', :version=> '0.4.9.9', :lib=>'youtube_g'
config.gem 'uuidtools', :version=> '1.0.4'
config.gem 'acts_as_ferret', :version=> '0.4.3'
config.gem 'ferret', :version=> '0.11.6'
config.gem 'hpricot', :version=> '0.6.164'
config.gem 'mocha', :version=> '0.9.3'
config.gem 'redgreen', :version=> '1.2.2' unless ENV['TM_MODE']
Expand Down
5 changes: 0 additions & 5 deletions config/ferret_server.yml

This file was deleted.

Empty file added db/sphinx/.gitignore
Empty file.
10 changes: 0 additions & 10 deletions script/ferret_server

This file was deleted.

2 changes: 2 additions & 0 deletions test/functional/profiles_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class ProfilesControllerTest < ActionController::TestCase

context 'on POST to :search' do
setup do
Profile.stubs(:search_results).returns(ThinkingSphinx::Collection.new(1, 1, 1, 1))
post :search, {:q => 'user'}
end

Expand All @@ -14,6 +15,7 @@ class ProfilesControllerTest < ActionController::TestCase

context 'on GET to :index' do
setup do
Profile.stubs(:search_results).returns(ThinkingSphinx::Collection.new(1, 1, 1, 1))
get :index
end

Expand Down
1 change: 1 addition & 0 deletions test/integration/spider_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def test_spider_user


def test_spider_admin
Profile.stubs(:search_results).returns(ThinkingSphinx::Collection.new(1, 1, 1, 1))
puts ''
puts 'test_spider_admin'
get "/login"
Expand Down
87 changes: 0 additions & 87 deletions vendor/gems/acts_as_ferret-0.4.3/.specification

This file was deleted.

52 changes: 0 additions & 52 deletions vendor/gems/acts_as_ferret-0.4.3/README

This file was deleted.

23 changes: 0 additions & 23 deletions vendor/gems/acts_as_ferret-0.4.3/bin/aaf_install

This file was deleted.

23 changes: 0 additions & 23 deletions vendor/gems/acts_as_ferret-0.4.3/config/ferret_server.yml

This file was deleted.

23 changes: 0 additions & 23 deletions vendor/gems/acts_as_ferret-0.4.3/doc/README.win32

This file was deleted.

22 changes: 0 additions & 22 deletions vendor/gems/acts_as_ferret-0.4.3/doc/monit-example

This file was deleted.

22 changes: 0 additions & 22 deletions vendor/gems/acts_as_ferret-0.4.3/init.rb

This file was deleted.

18 changes: 0 additions & 18 deletions vendor/gems/acts_as_ferret-0.4.3/install.rb

This file was deleted.

Loading

0 comments on commit 0507fd7

Please sign in to comment.