acts_as_ferret 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +32 -6
- data/acts_as_ferret.gemspec +260 -0
- data/config/ferret_server.yml +1 -0
- data/doc/demo/README +154 -0
- data/doc/demo/README_DEMO +23 -0
- data/doc/demo/Rakefile +10 -0
- data/doc/demo/app/controllers/admin/backend_controller.rb +14 -0
- data/doc/demo/app/controllers/admin_area_controller.rb +4 -0
- data/doc/demo/app/controllers/application.rb +5 -0
- data/doc/demo/app/controllers/contents_controller.rb +49 -0
- data/doc/demo/app/controllers/searches_controller.rb +8 -0
- data/doc/demo/app/helpers/admin/backend_helper.rb +2 -0
- data/doc/demo/app/helpers/application_helper.rb +3 -0
- data/doc/demo/app/helpers/content_helper.rb +2 -0
- data/doc/demo/app/helpers/search_helper.rb +2 -0
- data/doc/demo/app/models/comment.rb +48 -0
- data/doc/demo/app/models/content.rb +12 -0
- data/doc/demo/app/models/content_base.rb +28 -0
- data/doc/demo/app/models/search.rb +19 -0
- data/doc/demo/app/models/shared_index1.rb +3 -0
- data/doc/demo/app/models/shared_index2.rb +3 -0
- data/doc/demo/app/models/special_content.rb +3 -0
- data/doc/demo/app/models/stats.rb +20 -0
- data/doc/demo/app/views/admin/backend/search.rhtml +18 -0
- data/doc/demo/app/views/contents/_form.rhtml +10 -0
- data/doc/demo/app/views/contents/edit.rhtml +9 -0
- data/doc/demo/app/views/contents/index.rhtml +24 -0
- data/doc/demo/app/views/contents/new.rhtml +8 -0
- data/doc/demo/app/views/contents/show.rhtml +8 -0
- data/doc/demo/app/views/layouts/application.html.erb +17 -0
- data/doc/demo/app/views/searches/_content.html.erb +2 -0
- data/doc/demo/app/views/searches/search.html.erb +20 -0
- data/doc/demo/config/boot.rb +109 -0
- data/doc/demo/config/database.yml +38 -0
- data/doc/demo/config/environment.rb +69 -0
- data/doc/demo/config/environments/development.rb +16 -0
- data/doc/demo/config/environments/production.rb +19 -0
- data/doc/demo/config/environments/test.rb +21 -0
- data/doc/demo/config/ferret_server.yml +18 -0
- data/doc/demo/config/lighttpd.conf +40 -0
- data/doc/demo/config/routes.rb +9 -0
- data/doc/demo/db/development_structure.sql +15 -0
- data/doc/demo/db/migrate/001_initial_migration.rb +18 -0
- data/doc/demo/db/migrate/002_add_type_to_contents.rb +9 -0
- data/doc/demo/db/migrate/003_create_shared_index1s.rb +11 -0
- data/doc/demo/db/migrate/004_create_shared_index2s.rb +11 -0
- data/doc/demo/db/migrate/005_special_field.rb +9 -0
- data/doc/demo/db/migrate/006_create_stats.rb +15 -0
- data/doc/demo/db/schema.sql +18 -0
- data/doc/demo/doc/README_FOR_APP +2 -0
- data/doc/demo/doc/howto.txt +70 -0
- data/doc/demo/public/.htaccess +40 -0
- data/doc/demo/public/404.html +8 -0
- data/doc/demo/public/500.html +8 -0
- data/doc/demo/public/dispatch.cgi +10 -0
- data/doc/demo/public/dispatch.fcgi +24 -0
- data/doc/demo/public/dispatch.rb +10 -0
- data/doc/demo/public/favicon.ico +0 -0
- data/doc/demo/public/images/rails.png +0 -0
- data/doc/demo/public/index.html +277 -0
- data/doc/demo/public/robots.txt +1 -0
- data/doc/demo/public/stylesheets/scaffold.css +74 -0
- data/doc/demo/script/about +3 -0
- data/doc/demo/script/breakpointer +3 -0
- data/doc/demo/script/console +3 -0
- data/doc/demo/script/destroy +3 -0
- data/doc/demo/script/ferret_server +10 -0
- data/doc/demo/script/generate +3 -0
- data/doc/demo/script/performance/benchmarker +3 -0
- data/doc/demo/script/performance/profiler +3 -0
- data/doc/demo/script/plugin +3 -0
- data/doc/demo/script/process/inspector +3 -0
- data/doc/demo/script/process/reaper +3 -0
- data/doc/demo/script/process/spawner +3 -0
- data/doc/demo/script/process/spinner +3 -0
- data/doc/demo/script/runner +3 -0
- data/doc/demo/script/server +3 -0
- data/doc/demo/test/fixtures/comments.yml +12 -0
- data/doc/demo/test/fixtures/contents.yml +13 -0
- data/doc/demo/test/fixtures/remote_contents.yml +9 -0
- data/doc/demo/test/fixtures/shared_index1s.yml +7 -0
- data/doc/demo/test/fixtures/shared_index2s.yml +7 -0
- data/doc/demo/test/functional/admin/backend_controller_test.rb +35 -0
- data/doc/demo/test/functional/contents_controller_test.rb +81 -0
- data/doc/demo/test/functional/searches_controller_test.rb +71 -0
- data/doc/demo/test/smoke/drb_smoke_test.rb +321 -0
- data/doc/demo/test/smoke/process_stats.rb +21 -0
- data/doc/demo/test/test_helper.rb +30 -0
- data/doc/demo/test/unit/comment_test.rb +217 -0
- data/doc/demo/test/unit/content_test.rb +705 -0
- data/doc/demo/test/unit/ferret_result_test.rb +24 -0
- data/doc/demo/test/unit/multi_index_test.rb +329 -0
- data/doc/demo/test/unit/remote_index_test.rb +23 -0
- data/doc/demo/test/unit/shared_index1_test.rb +108 -0
- data/doc/demo/test/unit/shared_index2_test.rb +13 -0
- data/doc/demo/test/unit/sort_test.rb +21 -0
- data/doc/demo/test/unit/special_content_test.rb +25 -0
- data/doc/demo/vendor/plugins/will_paginate/LICENSE +18 -0
- data/doc/demo/vendor/plugins/will_paginate/README +108 -0
- data/doc/demo/vendor/plugins/will_paginate/Rakefile +23 -0
- data/doc/demo/vendor/plugins/will_paginate/init.rb +21 -0
- data/doc/demo/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +45 -0
- data/doc/demo/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +44 -0
- data/doc/demo/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +159 -0
- data/doc/demo/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +95 -0
- data/doc/demo/vendor/plugins/will_paginate/test/array_pagination_test.rb +23 -0
- data/doc/demo/vendor/plugins/will_paginate/test/boot.rb +27 -0
- data/doc/demo/vendor/plugins/will_paginate/test/console +10 -0
- data/doc/demo/vendor/plugins/will_paginate/test/finder_test.rb +219 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/admin.rb +3 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/companies.yml +24 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/company.rb +23 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/developer.rb +11 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml +13 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/project.rb +4 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/projects.yml +7 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/replies.yml +20 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/reply.rb +5 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/schema.sql +44 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/topic.rb +19 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/topics.yml +30 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/user.rb +2 -0
- data/doc/demo/vendor/plugins/will_paginate/test/fixtures/users.yml +35 -0
- data/doc/demo/vendor/plugins/will_paginate/test/helper.rb +42 -0
- data/doc/demo/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb +64 -0
- data/doc/demo/vendor/plugins/will_paginate/test/lib/load_fixtures.rb +10 -0
- data/doc/demo/vendor/plugins/will_paginate/test/pagination_test.rb +136 -0
- data/init.rb +2 -0
- data/lib/act_methods.rb +50 -157
- data/lib/acts_as_ferret.rb +457 -23
- data/lib/ar_mysql_auto_reconnect_patch.rb +41 -0
- data/lib/blank_slate.rb +53 -0
- data/lib/bulk_indexer.rb +4 -1
- data/lib/class_methods.rb +106 -295
- data/lib/ferret_extensions.rb +78 -5
- data/lib/ferret_find_methods.rb +141 -0
- data/lib/ferret_result.rb +26 -9
- data/lib/ferret_server.rb +100 -65
- data/lib/index.rb +83 -15
- data/lib/instance_methods.rb +32 -17
- data/lib/local_index.rb +106 -112
- data/lib/more_like_this.rb +13 -13
- data/lib/multi_index.rb +115 -72
- data/lib/rdig_adapter.rb +148 -0
- data/lib/remote_functions.rb +43 -0
- data/lib/remote_index.rb +25 -21
- data/lib/remote_multi_index.rb +20 -0
- data/lib/search_results.rb +7 -10
- data/lib/server_manager.rb +16 -4
- data/lib/unix_daemon.rb +23 -0
- data/lib/without_ar.rb +52 -0
- data/rakefile +23 -16
- data/recipes/aaf_recipes.rb +114 -0
- data/tasks/ferret.rake +22 -0
- metadata +233 -54
- data/lib/ferret_cap_tasks.rb +0 -21
- data/lib/shared_index.rb +0 -14
- data/lib/shared_index_class_methods.rb +0 -90
data/tasks/ferret.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :ferret do
|
2
|
+
|
3
|
+
# Rebuild index task. Declare the indexes to be rebuilt with the INDEXES
|
4
|
+
# environment variable:
|
5
|
+
#
|
6
|
+
# INDEXES="my_model shared" rake ferret:rebuild
|
7
|
+
desc "Rebuild a Ferret index. Specify what model to rebuild with the INDEXES environment variable."
|
8
|
+
task :rebuild => :environment do
|
9
|
+
indexes = ENV['INDEXES'].split
|
10
|
+
indexes.each do |index_name|
|
11
|
+
start = 1.minute.ago
|
12
|
+
ActsAsFerret::rebuild_index index_name
|
13
|
+
idx = ActsAsFerret::get_index index_name
|
14
|
+
# update records that have changed since the rebuild started
|
15
|
+
idx.index_definition[:registered_models].each do |m|
|
16
|
+
m.records_modified_since(start).each do |object|
|
17
|
+
object.ferret_update
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,81 +1,260 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.2
|
3
|
-
specification_version: 1
|
4
2
|
name: acts_as_ferret
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date: 2007-11-18 00:00:00 +01:00
|
8
|
-
summary: acts_as_ferret - Ferret based full text search for any ActiveRecord model
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: jk@jkraemer.net
|
12
|
-
homepage: http://projects.jkraemer.net/acts_as_ferret
|
13
|
-
rubyforge_project:
|
14
|
-
description:
|
15
|
-
autorequire: acts_as_ferret
|
16
|
-
default_executable: aaf_install
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 0.4.4
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Jens Kraemer
|
8
|
+
autorequire: acts_as_ferret
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-28 00:00:00 +02:00
|
13
|
+
default_executable: aaf_install
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: jk@jkraemer.net
|
18
|
+
executables:
|
19
|
+
- aaf_install
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
31
24
|
files:
|
25
|
+
- acts_as_ferret.gemspec
|
26
|
+
- bin
|
27
|
+
- bin/aaf_install
|
28
|
+
- config
|
29
|
+
- config/ferret_server.yml
|
30
|
+
- doc
|
31
|
+
- doc/demo
|
32
|
+
- doc/demo/app
|
33
|
+
- doc/demo/app/controllers
|
34
|
+
- doc/demo/app/controllers/admin
|
35
|
+
- doc/demo/app/controllers/admin/backend_controller.rb
|
36
|
+
- doc/demo/app/controllers/admin_area_controller.rb
|
37
|
+
- doc/demo/app/controllers/application.rb
|
38
|
+
- doc/demo/app/controllers/contents_controller.rb
|
39
|
+
- doc/demo/app/controllers/searches_controller.rb
|
40
|
+
- doc/demo/app/helpers
|
41
|
+
- doc/demo/app/helpers/admin
|
42
|
+
- doc/demo/app/helpers/admin/backend_helper.rb
|
43
|
+
- doc/demo/app/helpers/application_helper.rb
|
44
|
+
- doc/demo/app/helpers/content_helper.rb
|
45
|
+
- doc/demo/app/helpers/search_helper.rb
|
46
|
+
- doc/demo/app/models
|
47
|
+
- doc/demo/app/models/comment.rb
|
48
|
+
- doc/demo/app/models/content.rb
|
49
|
+
- doc/demo/app/models/content_base.rb
|
50
|
+
- doc/demo/app/models/search.rb
|
51
|
+
- doc/demo/app/models/shared_index1.rb
|
52
|
+
- doc/demo/app/models/shared_index2.rb
|
53
|
+
- doc/demo/app/models/special_content.rb
|
54
|
+
- doc/demo/app/models/stats.rb
|
55
|
+
- doc/demo/app/views
|
56
|
+
- doc/demo/app/views/admin
|
57
|
+
- doc/demo/app/views/admin/backend
|
58
|
+
- doc/demo/app/views/admin/backend/search.rhtml
|
59
|
+
- doc/demo/app/views/contents
|
60
|
+
- doc/demo/app/views/contents/_form.rhtml
|
61
|
+
- doc/demo/app/views/contents/edit.rhtml
|
62
|
+
- doc/demo/app/views/contents/index.rhtml
|
63
|
+
- doc/demo/app/views/contents/new.rhtml
|
64
|
+
- doc/demo/app/views/contents/show.rhtml
|
65
|
+
- doc/demo/app/views/layouts
|
66
|
+
- doc/demo/app/views/layouts/application.html.erb
|
67
|
+
- doc/demo/app/views/searches
|
68
|
+
- doc/demo/app/views/searches/_content.html.erb
|
69
|
+
- doc/demo/app/views/searches/search.html.erb
|
70
|
+
- doc/demo/config
|
71
|
+
- doc/demo/config/boot.rb
|
72
|
+
- doc/demo/config/database.yml
|
73
|
+
- doc/demo/config/environment.rb
|
74
|
+
- doc/demo/config/environments
|
75
|
+
- doc/demo/config/environments/development.rb
|
76
|
+
- doc/demo/config/environments/production.rb
|
77
|
+
- doc/demo/config/environments/test.rb
|
78
|
+
- doc/demo/config/ferret_server.yml
|
79
|
+
- doc/demo/config/lighttpd.conf
|
80
|
+
- doc/demo/config/routes.rb
|
81
|
+
- doc/demo/db
|
82
|
+
- doc/demo/db/development_structure.sql
|
83
|
+
- doc/demo/db/migrate
|
84
|
+
- doc/demo/db/migrate/001_initial_migration.rb
|
85
|
+
- doc/demo/db/migrate/002_add_type_to_contents.rb
|
86
|
+
- doc/demo/db/migrate/003_create_shared_index1s.rb
|
87
|
+
- doc/demo/db/migrate/004_create_shared_index2s.rb
|
88
|
+
- doc/demo/db/migrate/005_special_field.rb
|
89
|
+
- doc/demo/db/migrate/006_create_stats.rb
|
90
|
+
- doc/demo/db/schema.sql
|
91
|
+
- doc/demo/doc
|
92
|
+
- doc/demo/doc/howto.txt
|
93
|
+
- doc/demo/doc/README_FOR_APP
|
94
|
+
- doc/demo/log
|
95
|
+
- doc/demo/public
|
96
|
+
- doc/demo/public/.htaccess
|
97
|
+
- doc/demo/public/404.html
|
98
|
+
- doc/demo/public/500.html
|
99
|
+
- doc/demo/public/dispatch.cgi
|
100
|
+
- doc/demo/public/dispatch.fcgi
|
101
|
+
- doc/demo/public/dispatch.rb
|
102
|
+
- doc/demo/public/favicon.ico
|
103
|
+
- doc/demo/public/images
|
104
|
+
- doc/demo/public/images/rails.png
|
105
|
+
- doc/demo/public/index.html
|
106
|
+
- doc/demo/public/robots.txt
|
107
|
+
- doc/demo/public/stylesheets
|
108
|
+
- doc/demo/public/stylesheets/scaffold.css
|
109
|
+
- doc/demo/Rakefile
|
110
|
+
- doc/demo/README
|
111
|
+
- doc/demo/README_DEMO
|
112
|
+
- doc/demo/script
|
113
|
+
- doc/demo/script/about
|
114
|
+
- doc/demo/script/breakpointer
|
115
|
+
- doc/demo/script/console
|
116
|
+
- doc/demo/script/destroy
|
117
|
+
- doc/demo/script/ferret_server
|
118
|
+
- doc/demo/script/generate
|
119
|
+
- doc/demo/script/performance
|
120
|
+
- doc/demo/script/performance/benchmarker
|
121
|
+
- doc/demo/script/performance/profiler
|
122
|
+
- doc/demo/script/plugin
|
123
|
+
- doc/demo/script/process
|
124
|
+
- doc/demo/script/process/inspector
|
125
|
+
- doc/demo/script/process/reaper
|
126
|
+
- doc/demo/script/process/spawner
|
127
|
+
- doc/demo/script/process/spinner
|
128
|
+
- doc/demo/script/runner
|
129
|
+
- doc/demo/script/server
|
130
|
+
- doc/demo/test
|
131
|
+
- doc/demo/test/fixtures
|
132
|
+
- doc/demo/test/fixtures/comments.yml
|
133
|
+
- doc/demo/test/fixtures/contents.yml
|
134
|
+
- doc/demo/test/fixtures/remote_contents.yml
|
135
|
+
- doc/demo/test/fixtures/shared_index1s.yml
|
136
|
+
- doc/demo/test/fixtures/shared_index2s.yml
|
137
|
+
- doc/demo/test/functional
|
138
|
+
- doc/demo/test/functional/admin
|
139
|
+
- doc/demo/test/functional/admin/backend_controller_test.rb
|
140
|
+
- doc/demo/test/functional/contents_controller_test.rb
|
141
|
+
- doc/demo/test/functional/searches_controller_test.rb
|
142
|
+
- doc/demo/test/smoke
|
143
|
+
- doc/demo/test/smoke/drb_smoke_test.rb
|
144
|
+
- doc/demo/test/smoke/process_stats.rb
|
145
|
+
- doc/demo/test/test_helper.rb
|
146
|
+
- doc/demo/test/unit
|
147
|
+
- doc/demo/test/unit/comment_test.rb
|
148
|
+
- doc/demo/test/unit/content_test.rb
|
149
|
+
- doc/demo/test/unit/ferret_result_test.rb
|
150
|
+
- doc/demo/test/unit/multi_index_test.rb
|
151
|
+
- doc/demo/test/unit/remote_index_test.rb
|
152
|
+
- doc/demo/test/unit/shared_index1_test.rb
|
153
|
+
- doc/demo/test/unit/shared_index2_test.rb
|
154
|
+
- doc/demo/test/unit/sort_test.rb
|
155
|
+
- doc/demo/test/unit/special_content_test.rb
|
156
|
+
- doc/demo/vendor
|
157
|
+
- doc/demo/vendor/plugins
|
158
|
+
- doc/demo/vendor/plugins/will_paginate
|
159
|
+
- doc/demo/vendor/plugins/will_paginate/init.rb
|
160
|
+
- doc/demo/vendor/plugins/will_paginate/lib
|
161
|
+
- doc/demo/vendor/plugins/will_paginate/lib/will_paginate
|
162
|
+
- doc/demo/vendor/plugins/will_paginate/lib/will_paginate/collection.rb
|
163
|
+
- doc/demo/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb
|
164
|
+
- doc/demo/vendor/plugins/will_paginate/lib/will_paginate/finder.rb
|
165
|
+
- doc/demo/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb
|
166
|
+
- doc/demo/vendor/plugins/will_paginate/LICENSE
|
167
|
+
- doc/demo/vendor/plugins/will_paginate/Rakefile
|
168
|
+
- doc/demo/vendor/plugins/will_paginate/README
|
169
|
+
- doc/demo/vendor/plugins/will_paginate/test
|
170
|
+
- doc/demo/vendor/plugins/will_paginate/test/array_pagination_test.rb
|
171
|
+
- doc/demo/vendor/plugins/will_paginate/test/boot.rb
|
172
|
+
- doc/demo/vendor/plugins/will_paginate/test/console
|
173
|
+
- doc/demo/vendor/plugins/will_paginate/test/finder_test.rb
|
174
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures
|
175
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/admin.rb
|
176
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/companies.yml
|
177
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/company.rb
|
178
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/developer.rb
|
179
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/developers_projects.yml
|
180
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/project.rb
|
181
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/projects.yml
|
182
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/replies.yml
|
183
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/reply.rb
|
184
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/schema.sql
|
185
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/topic.rb
|
186
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/topics.yml
|
187
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/user.rb
|
188
|
+
- doc/demo/vendor/plugins/will_paginate/test/fixtures/users.yml
|
189
|
+
- doc/demo/vendor/plugins/will_paginate/test/helper.rb
|
190
|
+
- doc/demo/vendor/plugins/will_paginate/test/lib
|
191
|
+
- doc/demo/vendor/plugins/will_paginate/test/lib/activerecord_test_connector.rb
|
192
|
+
- doc/demo/vendor/plugins/will_paginate/test/lib/load_fixtures.rb
|
193
|
+
- doc/demo/vendor/plugins/will_paginate/test/pagination_test.rb
|
194
|
+
- doc/monit-example
|
195
|
+
- doc/README.win32
|
196
|
+
- init.rb
|
197
|
+
- install.rb
|
32
198
|
- lib
|
33
|
-
- lib/
|
199
|
+
- lib/act_methods.rb
|
34
200
|
- lib/acts_as_ferret.rb
|
35
|
-
- lib/
|
36
|
-
- lib/
|
37
|
-
- lib/
|
38
|
-
- lib/instance_methods.rb
|
201
|
+
- lib/ar_mysql_auto_reconnect_patch.rb
|
202
|
+
- lib/blank_slate.rb
|
203
|
+
- lib/bulk_indexer.rb
|
39
204
|
- lib/class_methods.rb
|
205
|
+
- lib/ferret_extensions.rb
|
206
|
+
- lib/ferret_find_methods.rb
|
207
|
+
- lib/ferret_result.rb
|
40
208
|
- lib/ferret_server.rb
|
41
|
-
- lib/
|
209
|
+
- lib/index.rb
|
210
|
+
- lib/instance_methods.rb
|
42
211
|
- lib/local_index.rb
|
212
|
+
- lib/more_like_this.rb
|
213
|
+
- lib/multi_index.rb
|
214
|
+
- lib/rdig_adapter.rb
|
215
|
+
- lib/remote_functions.rb
|
43
216
|
- lib/remote_index.rb
|
44
|
-
- lib/
|
45
|
-
- lib/act_methods.rb
|
46
|
-
- lib/shared_index_class_methods.rb
|
47
|
-
- lib/ferret_result.rb
|
217
|
+
- lib/remote_multi_index.rb
|
48
218
|
- lib/search_results.rb
|
49
|
-
- lib/bulk_indexer.rb
|
50
219
|
- lib/server_manager.rb
|
51
220
|
- lib/unix_daemon.rb
|
221
|
+
- lib/without_ar.rb
|
52
222
|
- LICENSE
|
53
223
|
- rakefile
|
54
|
-
- init.rb
|
55
224
|
- README
|
225
|
+
- recipes
|
226
|
+
- recipes/aaf_recipes.rb
|
56
227
|
- script
|
57
228
|
- script/ferret_daemon
|
58
|
-
- script/ferret_service
|
59
229
|
- script/ferret_server
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
- bin
|
67
|
-
- bin/aaf_install
|
68
|
-
test_files: []
|
69
|
-
|
230
|
+
- script/ferret_service
|
231
|
+
- tasks
|
232
|
+
- tasks/ferret.rake
|
233
|
+
has_rdoc: true
|
234
|
+
homepage: http://projects.jkraemer.net/acts_as_ferret
|
235
|
+
post_install_message:
|
70
236
|
rdoc_options: []
|
71
237
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
238
|
+
require_paths:
|
239
|
+
- lib
|
240
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
241
|
+
requirements:
|
242
|
+
- - ">="
|
243
|
+
- !ruby/object:Gem::Version
|
244
|
+
version: "0"
|
245
|
+
version:
|
246
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - ">="
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: "0"
|
251
|
+
version:
|
78
252
|
requirements: []
|
79
253
|
|
80
|
-
|
254
|
+
rubyforge_project:
|
255
|
+
rubygems_version: 1.3.1
|
256
|
+
signing_key:
|
257
|
+
specification_version: 2
|
258
|
+
summary: acts_as_ferret - Ferret based full text search for any ActiveRecord model
|
259
|
+
test_files: []
|
81
260
|
|
data/lib/ferret_cap_tasks.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# Ferret DRb server Capistrano tasks
|
2
|
-
# Usage:
|
3
|
-
# Add require 'vendor/plugins/acts_as_ferret/lib/ferret_cap_tasks' to your
|
4
|
-
# config/deploy.rb
|
5
|
-
# call ferret.restart where you restart your Mongrels.
|
6
|
-
# ferret.stop and ferret.start are available, too.
|
7
|
-
module FerretCapTasks
|
8
|
-
def start
|
9
|
-
run "cd #{current_path}; RAILS_ENV=production script/ferret_start"
|
10
|
-
end
|
11
|
-
|
12
|
-
def stop
|
13
|
-
run "cd #{current_path}; RAILS_ENV=production script/ferret_stop"
|
14
|
-
end
|
15
|
-
|
16
|
-
def restart
|
17
|
-
stop
|
18
|
-
start
|
19
|
-
end
|
20
|
-
end
|
21
|
-
Capistrano.plugin :ferret, FerretCapTasks
|
data/lib/shared_index.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
module ActsAsFerret
|
2
|
-
|
3
|
-
class SharedIndex < LocalIndex
|
4
|
-
|
5
|
-
# build a ferret query matching only the record with the given id and class
|
6
|
-
def query_for_record(id, class_name)
|
7
|
-
returning bq = Ferret::Search::BooleanQuery.new do
|
8
|
-
bq.add_query(Ferret::Search::TermQuery.new(:id, id.to_s), :must)
|
9
|
-
bq.add_query(Ferret::Search::TermQuery.new(:class_name, class_name), :must)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
module ActsAsFerret
|
2
|
-
|
3
|
-
# class methods for classes using acts_as_ferret :single_index => true
|
4
|
-
module SharedIndexClassMethods
|
5
|
-
|
6
|
-
def find_id_by_contents(q, options = {}, &block)
|
7
|
-
# add class name scoping to query if necessary
|
8
|
-
unless options[:models] == :all # search needs to be restricted by one or more class names
|
9
|
-
options[:models] ||= []
|
10
|
-
# add this class to the list of given models
|
11
|
-
options[:models] << self unless options[:models].include?(self)
|
12
|
-
# keep original query
|
13
|
-
original_query = q
|
14
|
-
|
15
|
-
if original_query.is_a? String
|
16
|
-
model_query = options[:models].map(&:name).join '|'
|
17
|
-
q += %{ +class_name:"#{model_query}"}
|
18
|
-
else
|
19
|
-
q = Ferret::Search::BooleanQuery.new
|
20
|
-
q.add_query(original_query, :must)
|
21
|
-
model_query = Ferret::Search::BooleanQuery.new
|
22
|
-
options[:models].each do |model|
|
23
|
-
model_query.add_query(Ferret::Search::TermQuery.new(:class_name, model.name), :should)
|
24
|
-
end
|
25
|
-
q.add_query(model_query, :must)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
options.delete :models
|
29
|
-
|
30
|
-
super(q, options, &block)
|
31
|
-
end
|
32
|
-
|
33
|
-
# Overrides the standard find_by_contents for searching a shared index.
|
34
|
-
#
|
35
|
-
# please note that records from different models will be fetched in
|
36
|
-
# separate sql calls, so any sql order_by clause given with
|
37
|
-
# find_options[:order] will be ignored.
|
38
|
-
def find_by_contents(q, options = {}, find_options = {})
|
39
|
-
if order = find_options.delete(:order)
|
40
|
-
logger.warn "using a shared index, so ignoring order_by clause #{order}"
|
41
|
-
end
|
42
|
-
total_hits, result = find_records_lazy_or_not q, options, find_options
|
43
|
-
# sort so results have the same order they had when originally retrieved
|
44
|
-
# from ferret
|
45
|
-
return SearchResults.new(result, total_hits)
|
46
|
-
end
|
47
|
-
|
48
|
-
protected
|
49
|
-
|
50
|
-
def ar_find_by_contents(q, options = {}, find_options = {})
|
51
|
-
total_hits, id_arrays = collect_results(q, options)
|
52
|
-
result = retrieve_records(id_arrays, find_options)
|
53
|
-
result.sort! { |a, b| id_arrays[a.class.name][a.id.to_s].first <=> id_arrays[b.class.name][b.id.to_s].first }
|
54
|
-
[ total_hits, result ]
|
55
|
-
end
|
56
|
-
|
57
|
-
def collect_results(q, options = {})
|
58
|
-
id_arrays = {}
|
59
|
-
# get object ids for index hits
|
60
|
-
rank = 0
|
61
|
-
total_hits = find_id_by_contents(q, options) do |model, id, score, data|
|
62
|
-
id_arrays[model] ||= {}
|
63
|
-
# store result rank and score
|
64
|
-
id_arrays[model][id] = [ rank += 1, score ]
|
65
|
-
end
|
66
|
-
[ total_hits, id_arrays ]
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
# determine all field names in the shared index
|
71
|
-
# TODO unused
|
72
|
-
# def single_index_field_names(models)
|
73
|
-
# @single_index_field_names ||= (
|
74
|
-
# searcher = Ferret::Search::Searcher.new(class_index_dir)
|
75
|
-
# if searcher.reader.respond_to?(:get_field_names)
|
76
|
-
# (searcher.reader.send(:get_field_names) - ['id', 'class_name']).to_a
|
77
|
-
# else
|
78
|
-
# puts <<-END
|
79
|
-
#unable to retrieve field names for class #{self.name}, please
|
80
|
-
#consider naming all indexed fields in your call to acts_as_ferret!
|
81
|
-
# END
|
82
|
-
# models.map { |m| m.content_columns.map { |col| col.name } }.flatten
|
83
|
-
# end
|
84
|
-
# )
|
85
|
-
#
|
86
|
-
# end
|
87
|
-
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|