acts_as_indexed 0.7.2 → 0.7.3
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/CHANGELOG +4 -0
- data/Rakefile +33 -1
- data/VERSION +1 -1
- data/acts_as_indexed.gemspec +4 -12
- data/lib/acts_as_indexed/class_methods.rb +3 -3
- data/lib/acts_as_indexed/configuration.rb +1 -1
- data/lib/acts_as_indexed/storage.rb +2 -2
- metadata +8 -14
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
===0.7.3 [3rd July 2011]
|
2
|
+
- Support for non-default primary keys. [ttoomey - Theron Toomey]
|
3
|
+
- Fixed issue with file-locking on JRuby. [banderso - Ben Anderson]
|
4
|
+
|
1
5
|
===0.7.2 [31st March 2011]
|
2
6
|
- Fixed bug with ranking of records [Christopher Souvey - bug report]
|
3
7
|
- Fixed a bug with the slicing of records before AR order is applied. [Christopher Souvey - bug report]
|
data/Rakefile
CHANGED
@@ -43,9 +43,41 @@ begin
|
|
43
43
|
gemspec.description = gemspec.summary
|
44
44
|
gemspec.email = "dougal.s@gmail.com"
|
45
45
|
gemspec.homepage = "http://github.com/dougal/acts_as_indexed"
|
46
|
-
gemspec.authors = ["Douglas F Shearer"]
|
46
|
+
gemspec.authors = ["Douglas F Shearer"]
|
47
47
|
end
|
48
48
|
Jeweler::GemcutterTasks.new
|
49
49
|
rescue LoadError
|
50
50
|
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
51
|
+
end
|
52
|
+
|
53
|
+
namespace :rvm do
|
54
|
+
AR_VERSIONS = %w{2.1.2 2.2.3 2.3.12 3.0.9}
|
55
|
+
INSTALLED_GEMSETS = `rvm gemset list`.scan(/aai_ar[^\n]+/)
|
56
|
+
|
57
|
+
desc "Setup RVM gemsets to test different versions of ActiveRecord"
|
58
|
+
task :test do
|
59
|
+
AR_VERSIONS.each do |version|
|
60
|
+
gemset_name = "aai_ar_#{ version }"
|
61
|
+
|
62
|
+
unless INSTALLED_GEMSETS.include?(gemset_name)
|
63
|
+
sh "rvm gemset create #{ gemset_name }"
|
64
|
+
sh "rvm gemset use aai_ar_#{ version }"
|
65
|
+
sh "gem install bundler --no-rdoc --no-ri"
|
66
|
+
sh "bundle install"
|
67
|
+
sh "gem install activerecord --version #{version} --no-rdoc --no-ri"
|
68
|
+
end
|
69
|
+
|
70
|
+
puts "Testing with Activerecord #{ version }"
|
71
|
+
puts "="*20
|
72
|
+
sh "rake test"
|
73
|
+
puts "="*20
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
task :cleanup do
|
78
|
+
INSTALLED_GEMSETS.each do |gemset|
|
79
|
+
sh "rvm --force gemset delete #{ gemset }"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
51
83
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.3
|
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.7.
|
8
|
+
s.version = "0.7.3"
|
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{2011-03
|
12
|
+
s.date = %q{2011-07-03}
|
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 = [
|
@@ -46,19 +46,11 @@ Gem::Specification.new do |s|
|
|
46
46
|
]
|
47
47
|
s.homepage = %q{http://github.com/dougal/acts_as_indexed}
|
48
48
|
s.require_paths = ["lib"]
|
49
|
-
s.rubygems_version = %q{1.
|
49
|
+
s.rubygems_version = %q{1.3.7}
|
50
50
|
s.summary = %q{Acts As Indexed is a plugin which provides a pain-free way to add fulltext search to your Ruby on Rails app}
|
51
|
-
s.test_files = [
|
52
|
-
"test/abstract_unit.rb",
|
53
|
-
"test/acts_as_indexed_test.rb",
|
54
|
-
"test/configuration_test.rb",
|
55
|
-
"test/fixtures/post.rb",
|
56
|
-
"test/schema.rb",
|
57
|
-
"test/search_atom_test.rb",
|
58
|
-
"test/search_index_test.rb"
|
59
|
-
]
|
60
51
|
|
61
52
|
if s.respond_to? :specification_version then
|
53
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
62
54
|
s.specification_version = 3
|
63
55
|
|
64
56
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -35,9 +35,9 @@ module ActsAsIndexed
|
|
35
35
|
|
36
36
|
# scope for Rails 3.x, named_scope for Rails 2.x.
|
37
37
|
if self.respond_to?(:where)
|
38
|
-
scope :with_query, lambda { |query| where("#{table_name}
|
38
|
+
scope :with_query, lambda { |query| where("#{table_name}.#{primary_key} IN (?)", search_index(query, {}, {:ids_only => true})) }
|
39
39
|
else
|
40
|
-
named_scope :with_query, lambda { |query| { :conditions => ["#{table_name}
|
40
|
+
named_scope :with_query, lambda { |query| { :conditions => ["#{table_name}.#{primary_key} IN (?)", search_index(query, {}, {:ids_only => true}) ] } }
|
41
41
|
end
|
42
42
|
|
43
43
|
cattr_accessor :aai_config, :aai_fields
|
@@ -143,7 +143,7 @@ module ActsAsIndexed
|
|
143
143
|
with_scope :find => find_options do
|
144
144
|
# Doing the find like this eliminates the possibility of errors occuring
|
145
145
|
# on either missing records (out-of-sync) or an empty results array.
|
146
|
-
records = find(:all, :conditions => [ "#{table_name}
|
146
|
+
records = find(:all, :conditions => [ "#{table_name}.#{primary_key} IN (?)", part_query])
|
147
147
|
|
148
148
|
if find_options.include?(:order)
|
149
149
|
records # Just return the records without ranking them.
|
@@ -9,7 +9,7 @@ module ActsAsIndexed
|
|
9
9
|
|
10
10
|
# Sets the location for the index. Specify as an array. Heroku, for
|
11
11
|
# example would use RAILS_ROOT/tmp/index, which would be set as
|
12
|
-
# [Rails.root,'tmp','index]
|
12
|
+
# [Rails.root,'tmp','index']
|
13
13
|
attr_accessor :index_file
|
14
14
|
|
15
15
|
# Tuning value for the index partitioning. Larger values result in quicker
|
@@ -169,7 +169,7 @@ module ActsAsIndexed #:nodoc:
|
|
169
169
|
def lock_file(file_path, &block) # :nodoc:
|
170
170
|
# Windows does not support file locking.
|
171
171
|
if !windows? && file_path.exist?
|
172
|
-
file_path.open('r') do |f|
|
172
|
+
file_path.open('r+') do |f|
|
173
173
|
begin
|
174
174
|
f.flock File::LOCK_EX
|
175
175
|
yield
|
@@ -187,4 +187,4 @@ module ActsAsIndexed #:nodoc:
|
|
187
187
|
end
|
188
188
|
|
189
189
|
end
|
190
|
-
end
|
190
|
+
end
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 5
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 3
|
10
|
+
version: 0.7.3
|
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: 2011-03
|
18
|
+
date: 2011-07-03 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -85,15 +85,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements: []
|
86
86
|
|
87
87
|
rubyforge_project:
|
88
|
-
rubygems_version: 1.
|
88
|
+
rubygems_version: 1.3.7
|
89
89
|
signing_key:
|
90
90
|
specification_version: 3
|
91
91
|
summary: Acts As Indexed is a plugin which provides a pain-free way to add fulltext search to your Ruby on Rails app
|
92
|
-
test_files:
|
93
|
-
|
94
|
-
- test/acts_as_indexed_test.rb
|
95
|
-
- test/configuration_test.rb
|
96
|
-
- test/fixtures/post.rb
|
97
|
-
- test/schema.rb
|
98
|
-
- test/search_atom_test.rb
|
99
|
-
- test/search_index_test.rb
|
92
|
+
test_files: []
|
93
|
+
|