dusen 0.4.9 → 0.4.10
Sign up to get free protection for your applications and to get access to all the features.
- data/dusen.gemspec +1 -1
- data/lib/dusen/active_record/search_text.rb +2 -2
- data/lib/dusen/version.rb +1 -1
- data/spec/rails-2.3/Gemfile.lock +2 -2
- data/spec/rails-3.0/Gemfile.lock +2 -2
- data/spec/rails-3.2/Gemfile.lock +2 -2
- data/spec/shared/spec/dusen/active_record/search_text_spec.rb +10 -0
- metadata +7 -7
data/dusen.gemspec
CHANGED
@@ -26,11 +26,11 @@ module Dusen
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.synchronize_model(model)
|
29
|
+
model = model.origin_class
|
29
30
|
invalid_index_records = for_model(model).invalid
|
30
31
|
source_ids = invalid_index_records.collect_column(:source_id)
|
31
32
|
pending_source_ids = Set.new(source_ids)
|
32
|
-
|
33
|
-
source_records.find_in_batches do |batch|
|
33
|
+
model.find_in_batches(:conditions => { :id => source_ids } ) do |batch|
|
34
34
|
batch.each do |source_record|
|
35
35
|
source_record.index_search_text
|
36
36
|
pending_source_ids.delete(source_record.id)
|
data/lib/dusen/version.rb
CHANGED
data/spec/rails-2.3/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
dusen (0.4.9)
|
5
5
|
activerecord
|
6
|
-
edge_rider (>= 0.2.
|
6
|
+
edge_rider (>= 0.2.5)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -21,7 +21,7 @@ GEM
|
|
21
21
|
andand (1.3.3)
|
22
22
|
columnize (0.3.6)
|
23
23
|
database_cleaner (1.0.1)
|
24
|
-
edge_rider (0.2.
|
24
|
+
edge_rider (0.2.5)
|
25
25
|
activerecord
|
26
26
|
hoe (2.8.0)
|
27
27
|
rake (>= 0.8.7)
|
data/spec/rails-3.0/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
dusen (0.4.9)
|
5
5
|
activerecord
|
6
|
-
edge_rider (>= 0.2.
|
6
|
+
edge_rider (>= 0.2.5)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -41,7 +41,7 @@ GEM
|
|
41
41
|
columnize (0.3.6)
|
42
42
|
database_cleaner (1.0.1)
|
43
43
|
diff-lcs (1.2.4)
|
44
|
-
edge_rider (0.2.
|
44
|
+
edge_rider (0.2.5)
|
45
45
|
activerecord
|
46
46
|
erubis (2.6.6)
|
47
47
|
abstract (>= 1.0.0)
|
data/spec/rails-3.2/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ PATH
|
|
3
3
|
specs:
|
4
4
|
dusen (0.4.9)
|
5
5
|
activerecord
|
6
|
-
edge_rider (>= 0.2.
|
6
|
+
edge_rider (>= 0.2.5)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -41,7 +41,7 @@ GEM
|
|
41
41
|
columnize (0.3.6)
|
42
42
|
database_cleaner (1.0.1)
|
43
43
|
diff-lcs (1.2.4)
|
44
|
-
edge_rider (0.2.
|
44
|
+
edge_rider (0.2.5)
|
45
45
|
activerecord
|
46
46
|
erubis (2.7.0)
|
47
47
|
hike (1.2.2)
|
@@ -38,6 +38,16 @@ describe Dusen::ActiveRecord::SearchText do
|
|
38
38
|
Dusen::ActiveRecord::SearchText.count.should be_zero
|
39
39
|
end
|
40
40
|
|
41
|
+
it 'should not remove non-orphaned index records when called with a scope that excludes their source (bugfix)' do
|
42
|
+
user1 = User::WithFulltext.create!
|
43
|
+
user2 = User::WithFulltext.create!
|
44
|
+
Dusen::ActiveRecord::SearchText.count.should == 2
|
45
|
+
scope = Dusen::Util.append_scope_conditions(User::WithFulltext, :id => [user2.id])
|
46
|
+
Dusen::ActiveRecord::SearchText.synchronize_model(scope)
|
47
|
+
Dusen::ActiveRecord::SearchText.count.should == 2
|
48
|
+
end
|
49
|
+
|
41
50
|
end
|
42
51
|
|
43
52
|
end
|
53
|
+
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dusen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 10
|
10
|
+
version: 0.4.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Henning Koch
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2014-
|
18
|
+
date: 2014-05-05 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -40,12 +40,12 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
43
|
+
hash: 29
|
44
44
|
segments:
|
45
45
|
- 0
|
46
46
|
- 2
|
47
|
-
-
|
48
|
-
version: 0.2.
|
47
|
+
- 5
|
48
|
+
version: 0.2.5
|
49
49
|
type: :runtime
|
50
50
|
version_requirements: *id002
|
51
51
|
description: Comprehensive full text search for ActiveRecord and MySQL
|