acts_as_indexed 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/CHANGELOG +6 -1
- data/README.rdoc +16 -8
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/acts_as_indexed.gemspec +2 -2
- data/lib/acts_as_indexed/configuration.rb +20 -1
- data/test/acts_as_indexed_test.rb +1 -1
- data/test/configuration_test.rb +1 -1
- data/test/search_atom_test.rb +1 -1
- data/test/search_index_test.rb +1 -1
- metadata +4 -4
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
+
===0.6.6 [31st August 2010]
|
2
|
+
- Now Heroku compatible out of the box, index is created in tmp when root dir is non-writable. [parndt - Philip Arndt - Great suggestion]
|
3
|
+
- Fixed a require path issue on 1.9.2.
|
4
|
+
- Fixed an issue with index_file location on Rails 3.0.0 final.
|
5
|
+
|
1
6
|
===0.6.5 [19th August 2010]
|
2
|
-
- Reintroduced support for older version of Ruby which do not implement Array#exclude? [bug report by Andy
|
7
|
+
- Reintroduced support for older version of Ruby which do not implement Array#exclude? [bug report by Andy Eggers]
|
3
8
|
- Using Bundler to manage development dependencies.
|
4
9
|
|
5
10
|
===0.6.4 [16th August 2010]
|
data/README.rdoc
CHANGED
@@ -30,7 +30,8 @@ acts_as_indexed is now available as a Gem as several people have requested it.
|
|
30
30
|
|
31
31
|
gem install acts_as_indexed
|
32
32
|
|
33
|
-
Make sure to specify the Gem in your environment.rb file (Rails 2.x.x), or the
|
33
|
+
Make sure to specify the Gem in your environment.rb file (Rails 2.x.x), or the
|
34
|
+
Gemfile (Rails 3.x.x).
|
34
35
|
|
35
36
|
==== No Git?
|
36
37
|
|
@@ -65,14 +66,17 @@ the current model.
|
|
65
66
|
...
|
66
67
|
end
|
67
68
|
|
68
|
-
Any of the configuration options in the Further Configuration section can be
|
69
|
+
Any of the configuration options in the Further Configuration section can be
|
70
|
+
added as to the acts_as_indexed method call. These will override any defaults
|
71
|
+
or global configuration.
|
69
72
|
|
70
|
-
You can specify proc that needs to evaluate to true before the item gets
|
71
|
-
This is useful if you only want items with a certain state to be
|
72
|
-
The Proc is passed the current object's instance so you are able to
|
73
|
+
You can specify proc that needs to evaluate to true before the item gets
|
74
|
+
indexed. This is useful if you only want items with a certain state to be
|
75
|
+
included. The Proc is passed the current object's instance so you are able to
|
76
|
+
test against that.
|
73
77
|
|
74
|
-
For example, if you have a visible column that is false if the post is hidden,
|
75
|
-
if it is visible, you can filter the index by doing:
|
78
|
+
For example, if you have a visible column that is false if the post is hidden,
|
79
|
+
or true if it is visible, you can filter the index by doing:
|
76
80
|
|
77
81
|
class Post < ActiveRecord::Base
|
78
82
|
acts_as_indexed :fields => [:title, :body], :if => Proc.new { |post| post.visible? }
|
@@ -114,7 +118,7 @@ A config block can be provided in your environment files or initializers.
|
|
114
118
|
Example showing defaults:
|
115
119
|
|
116
120
|
ActsAsIndexed.configure do |config|
|
117
|
-
config.index_file = [RAILS_ROOT,'index']
|
121
|
+
config.index_file = [RAILS_ROOT,'index']
|
118
122
|
config.index_file_depth = 3
|
119
123
|
config.min_word_size = 3
|
120
124
|
end
|
@@ -122,6 +126,10 @@ Example showing defaults:
|
|
122
126
|
A full rundown of the available configuration options can be found in
|
123
127
|
<tt>lib/acts_as_indexed/configuration.rb</tt>
|
124
128
|
|
129
|
+
=== Heroku Support
|
130
|
+
|
131
|
+
Acts As Indexed now supports Heroku out-of-the-box. When a non-writeable root
|
132
|
+
directory is detected, the index will be created in the tmp directory.
|
125
133
|
|
126
134
|
== RDoc Documentation
|
127
135
|
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.6
|
data/acts_as_indexed.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{acts_as_indexed}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Douglas F Shearer"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-31}
|
13
13
|
s.description = %q{Acts As Indexed is a plugin which provides a pain-free way to add fulltext search to your Ruby on Rails app}
|
14
14
|
s.email = %q{dougal.s@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -27,12 +27,21 @@ module ActsAsIndexed
|
|
27
27
|
attr_accessor :if_proc
|
28
28
|
|
29
29
|
def initialize
|
30
|
-
@index_file =
|
30
|
+
@index_file = nil
|
31
31
|
@index_file_depth = 3
|
32
32
|
@min_word_size = 3
|
33
33
|
@if_proc = if_proc
|
34
34
|
end
|
35
35
|
|
36
|
+
# Since we cannot expect Rails to be available on load, it is best to put
|
37
|
+
# off setting the index_file attribute until as late as possible.
|
38
|
+
def index_file
|
39
|
+
if @index_file.nil?
|
40
|
+
@index_file = default_index_file
|
41
|
+
end
|
42
|
+
@index_file
|
43
|
+
end
|
44
|
+
|
36
45
|
def index_file=(file_path)
|
37
46
|
# Under the old syntax this was an array of path parts.
|
38
47
|
# If this is still using the array then rewrite to a Pathname.
|
@@ -57,5 +66,15 @@ module ActsAsIndexed
|
|
57
66
|
@if_proc ||= Proc.new{true}
|
58
67
|
end
|
59
68
|
|
69
|
+
private
|
70
|
+
|
71
|
+
def default_index_file
|
72
|
+
if Rails.root.writable?
|
73
|
+
Rails.root.join('index')
|
74
|
+
else
|
75
|
+
Rails.root.join('tmp', 'index')
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
60
79
|
end
|
61
80
|
end
|
data/test/configuration_test.rb
CHANGED
data/test/search_atom_test.rb
CHANGED
data/test/search_index_test.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_indexed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 6
|
10
|
+
version: 0.6.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Douglas F Shearer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-31 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|