acts_as_ferret 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +36 -8
- data/lib/acts_as_ferret/ferret_extensions.rb +14 -11
- data/lib/acts_as_ferret/local_index.rb +0 -3
- data/lib/acts_as_ferret/version.rb +1 -1
- data/recipes/aaf_recipes.rb +4 -2
- metadata +38 -14
- data/doc/README.win32 +0 -23
data/README
CHANGED
@@ -6,10 +6,17 @@ It is heavily based on the original acts_as_ferret plugin done by
|
|
6
6
|
Kasper Weibel and a modified version done by Thomas Lockney, which
|
7
7
|
both can be found on http://ferret.davebalmain.com/trac/wiki/FerretOnRails
|
8
8
|
|
9
|
-
== Project Wiki and Issue tracker
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
== Project URLs
|
11
|
+
|
12
|
+
Wiki: http://wiki.github.com/jkraemer/acts_as_ferret/
|
13
|
+
Please post issues on Lighthouse: http://j-k.lighthouseapp.com/projects/45560-acts-as-ferret
|
14
|
+
API docs: http://rdoc.info/github/jkraemer/acts_as_ferret
|
15
|
+
|
16
|
+
== Supported Rails versions
|
17
|
+
|
18
|
+
From version 0.5 onwards acts_as_ferret requires Rails 3. For earlier Rails versions (2.3.x, ymmv for earlier versions)
|
19
|
+
please use acts_as_ferret versions 0.4.x or the rails-2.3.x branch on github.
|
13
20
|
|
14
21
|
== Installation
|
15
22
|
|
@@ -17,14 +24,22 @@ Aaf is available as a gem (gem install acts_as_ferret), or via git from github.c
|
|
17
24
|
Github also offers tarball downloads, check out
|
18
25
|
http://github.com/jkraemer/acts_as_ferret/tree/master .
|
19
26
|
|
20
|
-
=== Set up your Rails > 2.1 project to use the acts_as_ferret gem.
|
21
27
|
|
22
|
-
|
28
|
+
=== Rails 3
|
23
29
|
|
24
|
-
|
30
|
+
add
|
25
31
|
|
26
|
-
|
27
|
-
|
32
|
+
<tt>gem 'acts_as_ferret', '>= 0.5'</tt>
|
33
|
+
|
34
|
+
to your Gemfile. Bundler will pull in the jk-ferret gem as a dependency, which is an 'unofficial'
|
35
|
+
Ferret gem built by me based on Ferret's master branch on github (the latest official ferret gem is 0.11.6
|
36
|
+
and is missing quite some bug fixes that happened since then).
|
37
|
+
|
38
|
+
After running 'bundle install', have bundler execute the aaf_install script:
|
39
|
+
|
40
|
+
<tt>bundle exec aaf_install</tt>
|
41
|
+
|
42
|
+
This will copy the capistrano recipe, the ferret server config and it's startup script
|
28
43
|
into your project.
|
29
44
|
|
30
45
|
In order to have the capistrano recipe loaded you'll have to patch your Capfile a bit. I use to have
|
@@ -33,6 +48,19 @@ a line like that in my Capfiles, loading everything found below RAILS_ROOT/lib/r
|
|
33
48
|
<tt>Dir['lib/recipes/**/*.rb'].each { |plugin| load(plugin) }</tt>
|
34
49
|
|
35
50
|
|
51
|
+
=== Rails 2.x
|
52
|
+
|
53
|
+
To set up your Rails project to use the acts_as_ferret gem, add this to your project's config/environment.rb:
|
54
|
+
|
55
|
+
<tt>config.gem 'acts_as_ferret', :version => '~> 0.4.8'</tt>
|
56
|
+
|
57
|
+
With the gem installed, change into your RAILS_ROOT and run the supplied aaf_install script.
|
58
|
+
This will copy rake tasks, capistrano recipes and the ferret server config and startup script
|
59
|
+
into your project.
|
60
|
+
|
61
|
+
If you're using Capistrano, patch your Capfile as described above for Rails 3.
|
62
|
+
|
63
|
+
|
36
64
|
=== Installation inside your Rails project via script/plugin
|
37
65
|
|
38
66
|
script/plugin install git://github.com/jkraemer/acts_as_ferret.git
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module Ferret
|
1
|
+
module Ferret
|
2
2
|
|
3
3
|
module Analysis
|
4
4
|
|
@@ -94,6 +94,19 @@ module Ferret
|
|
94
94
|
flush()
|
95
95
|
end
|
96
96
|
end
|
97
|
+
|
98
|
+
# search for the first document with +arg+ in the +id+ field and return it's internal document number.
|
99
|
+
# The +id+ field is either :id or whatever you set
|
100
|
+
# :id_field parameter to when you create the Index object.
|
101
|
+
def doc_number(id)
|
102
|
+
@dir.synchronize do
|
103
|
+
ensure_reader_open()
|
104
|
+
term_doc_enum = @reader.term_docs_for(@id_field, id.to_s)
|
105
|
+
return term_doc_enum.next? ? term_doc_enum.doc : nil
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
private
|
97
110
|
|
98
111
|
# If +docs+ is a Hash or an Array then a batch delete will be performed.
|
99
112
|
# If +docs+ is an Array then it will be considered an array of +id+'s. If
|
@@ -135,16 +148,6 @@ module Ferret
|
|
135
148
|
return self
|
136
149
|
end
|
137
150
|
|
138
|
-
# search for the first document with +arg+ in the +id+ field and return it's internal document number.
|
139
|
-
# The +id+ field is either :id or whatever you set
|
140
|
-
# :id_field parameter to when you create the Index object.
|
141
|
-
def doc_number(id)
|
142
|
-
@dir.synchronize do
|
143
|
-
ensure_reader_open()
|
144
|
-
term_doc_enum = @reader.term_docs_for(@id_field, id.to_s)
|
145
|
-
return term_doc_enum.next? ? term_doc_enum.doc : nil
|
146
|
-
end
|
147
|
-
end
|
148
151
|
end
|
149
152
|
|
150
153
|
# add marshalling support to SortFields
|
@@ -73,9 +73,6 @@ module ActsAsFerret
|
|
73
73
|
reader.tokenized_fields unless options[:tokenized_fields]
|
74
74
|
return qp.parse query
|
75
75
|
else
|
76
|
-
# work around ferret bug in #process_query (doesn't ensure the
|
77
|
-
# reader is open)
|
78
|
-
ferret_index.send(:ensure_reader_open)
|
79
76
|
return ferret_index.process_query(query)
|
80
77
|
end
|
81
78
|
end
|
data/recipes/aaf_recipes.rb
CHANGED
@@ -46,13 +46,15 @@ namespace :ferret do
|
|
46
46
|
desc "Stop the Ferret DRb server"
|
47
47
|
task :stop, :roles => :app do
|
48
48
|
rails_env = fetch(:rails_env, 'production')
|
49
|
-
|
49
|
+
ruby = fetch(:ruby, '/usr/bin/env ruby')
|
50
|
+
run "cd #{current_path}; #{ruby} script/ferret_server -e #{rails_env} stop || true"
|
50
51
|
end
|
51
52
|
|
52
53
|
desc "Start the Ferret DRb server"
|
53
54
|
task :start, :roles => :app do
|
54
55
|
rails_env = fetch(:rails_env, 'production')
|
55
|
-
|
56
|
+
ruby = fetch(:ruby, '/usr/bin/env ruby')
|
57
|
+
run "cd #{current_path}; #{ruby} script/ferret_server -e #{rails_env} start"
|
56
58
|
end
|
57
59
|
|
58
60
|
desc "Restart the Ferret DRb server"
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_ferret
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 15
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 5
|
9
|
+
- 2
|
10
|
+
version: 0.5.2
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Jens Kraemer
|
@@ -9,29 +15,40 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-10-26 00:00:00 +02:00
|
13
19
|
default_executable: aaf_install
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: jk-ferret
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 35
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 11
|
33
|
+
- 8
|
23
34
|
version: 0.11.8
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
- !ruby/object:Gem::Dependency
|
26
38
|
name: rails
|
27
|
-
|
28
|
-
|
29
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
30
42
|
requirements:
|
31
43
|
- - ">="
|
32
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 7
|
46
|
+
segments:
|
47
|
+
- 3
|
48
|
+
- 0
|
33
49
|
version: "3.0"
|
34
|
-
|
50
|
+
type: :runtime
|
51
|
+
version_requirements: *id002
|
35
52
|
description: Rails plugin that adds powerful full text search capabilities to ActiveRecord models.
|
36
53
|
email: jk@jkraemer.net
|
37
54
|
executables:
|
@@ -46,7 +63,6 @@ files:
|
|
46
63
|
- LICENSE
|
47
64
|
- bin/aaf_install
|
48
65
|
- config/ferret_server.yml
|
49
|
-
- doc/README.win32
|
50
66
|
- doc/demo/README
|
51
67
|
- doc/demo/README_DEMO
|
52
68
|
- doc/demo/Rakefile
|
@@ -213,21 +229,29 @@ rdoc_options:
|
|
213
229
|
require_paths:
|
214
230
|
- lib
|
215
231
|
required_ruby_version: !ruby/object:Gem::Requirement
|
232
|
+
none: false
|
216
233
|
requirements:
|
217
234
|
- - ">="
|
218
235
|
- !ruby/object:Gem::Version
|
236
|
+
hash: 57
|
237
|
+
segments:
|
238
|
+
- 1
|
239
|
+
- 8
|
240
|
+
- 7
|
219
241
|
version: 1.8.7
|
220
|
-
version:
|
221
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
|
+
none: false
|
222
244
|
requirements:
|
223
245
|
- - ">="
|
224
246
|
- !ruby/object:Gem::Version
|
247
|
+
hash: 3
|
248
|
+
segments:
|
249
|
+
- 0
|
225
250
|
version: "0"
|
226
|
-
version:
|
227
251
|
requirements: []
|
228
252
|
|
229
253
|
rubyforge_project: acts_as_ferret
|
230
|
-
rubygems_version: 1.3.
|
254
|
+
rubygems_version: 1.3.7
|
231
255
|
signing_key:
|
232
256
|
specification_version: 3
|
233
257
|
summary: acts_as_ferret - Ferret based full text search for any ActiveRecord model
|
data/doc/README.win32
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
Credits
|
2
|
-
=======
|
3
|
-
|
4
|
-
The Win32 service support scripts have been written by
|
5
|
-
Herryanto Siatono <herryanto@pluitsolutions.com>.
|
6
|
-
|
7
|
-
See his accompanying blog posting at
|
8
|
-
http://www.pluitsolutions.com/2007/07/30/acts-as-ferret-drbserver-win32-service/
|
9
|
-
|
10
|
-
|
11
|
-
Usage
|
12
|
-
=====
|
13
|
-
|
14
|
-
There are two scripts:
|
15
|
-
|
16
|
-
script/ferret_service is used to install/remove/start/stop the win32 service.
|
17
|
-
|
18
|
-
script/ferret_daemon is to be called by Win32 service to start/stop the
|
19
|
-
DRbServer.
|
20
|
-
|
21
|
-
Run 'ruby script/ferret_service -h' for more info.
|
22
|
-
|
23
|
-
|