picky 4.17.0 → 4.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/picky/indexers/parallel.rb +1 -1
- data/spec/lib/indexers/parallel_spec.rb +68 -13
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTkyZGMwZGMyNjFiNTVlMjU2Mjg5ZjhmMGY2MzM2N2NlY2M5YmEzMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmYzMWQ5OTM0YzdiZDVlYjMyMzliZWY5ZDYzZWU4M2JiNmJkNDEwMg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZmE5NDZlZjVhN2I2OGM2YzUyMmM0ZWFjMGU4Mjc5NzA0MmEwMmU5MTg1ZDg0
|
10
|
+
ZWJiYzhiZTc4MDgzMjY3MGZlM2U3N2QxOTMyZWY2NzQzN2UwZmVkYWRjZWVl
|
11
|
+
YzdkNGFjYjYwZTM5ODdlOGMzZGY4MjljNjk5ZDYzZmU3MzcwMGE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDY1OThhODliOWI4M2VmOTM3MWYzZTVmNjlmMDM4NzhiNmZkY2UzOTdkYTJl
|
14
|
+
MTA0N2U0MjVhYTU4YTYxZDI2ZDBiYjMxNGYzODFkNGUyM2VjMGJiZTI5NDZl
|
15
|
+
OGVlZWJlODhiNzY5YmJjODk3NjMzMTQ5NjBkYWM5MTk0ZmYyOTI=
|
@@ -19,7 +19,7 @@ module Picky
|
|
19
19
|
# Prepare a combined object - array.
|
20
20
|
#
|
21
21
|
combined = categories.map do |category|
|
22
|
-
[category, category.prepared_index_file, [],
|
22
|
+
[category, category.prepared_index_file, [], category.tokenizer]
|
23
23
|
end
|
24
24
|
|
25
25
|
# Go through each object in the source.
|
@@ -1,28 +1,83 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Picky::Indexers::Parallel do
|
4
|
+
|
5
|
+
thing = Struct.new :id, :text
|
4
6
|
|
5
7
|
before(:each) do
|
6
|
-
@
|
7
|
-
@index = stub :index, :name => :some_index, :source => @source
|
8
|
-
|
9
|
-
@categories = stub :categories
|
10
|
-
|
8
|
+
@index = Picky::Index.new(:test) # stub :index, :name => :some_index, :source => @source, :backend => stub(:backend)
|
11
9
|
@indexer = described_class.new @index
|
12
10
|
@indexer.stub! :timed_exclaim
|
13
11
|
end
|
12
|
+
|
13
|
+
context 'with untokenized category' do
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
@categories = [
|
17
|
+
Picky::Category.new(:text, @index)
|
18
|
+
]
|
19
|
+
@source = [
|
20
|
+
thing.new(1, "hello"),
|
21
|
+
thing.new(2, "world"),
|
22
|
+
]
|
23
|
+
end
|
14
24
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
25
|
+
describe 'flush' do
|
26
|
+
it 'flushes to joined cache to the file and clears it' do
|
27
|
+
cache = stub :cache
|
28
|
+
file = stub :file
|
19
29
|
|
20
|
-
|
21
|
-
|
22
|
-
|
30
|
+
cache.should_receive(:join).once.and_return :joined
|
31
|
+
file.should_receive(:write).once.with(:joined).and_return :joined
|
32
|
+
cache.should_receive(:clear).once
|
23
33
|
|
24
|
-
|
34
|
+
@indexer.flush file, cache
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'process' do
|
39
|
+
it 'flushes to joined cache to the file and clears it' do
|
40
|
+
@indexer.process @source, @categories do |file|
|
41
|
+
file.path.should == 'spec/temp/index/test/test/text.prepared.txt'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'with tokenized category' do
|
49
|
+
|
50
|
+
before(:each) do
|
51
|
+
@categories = [
|
52
|
+
Picky::Category.new(:text, @index, tokenize: false)
|
53
|
+
]
|
54
|
+
@source = [
|
55
|
+
thing.new(1, ["hello"]),
|
56
|
+
thing.new(2, ["world"]),
|
57
|
+
]
|
58
|
+
end
|
59
|
+
|
60
|
+
describe 'flush' do
|
61
|
+
it 'flushes to joined cache to the file and clears it' do
|
62
|
+
cache = stub :cache
|
63
|
+
file = stub :file
|
64
|
+
|
65
|
+
cache.should_receive(:join).once.and_return :joined
|
66
|
+
file.should_receive(:write).once.with(:joined).and_return :joined
|
67
|
+
cache.should_receive(:clear).once
|
68
|
+
|
69
|
+
@indexer.flush file, cache
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'process' do
|
74
|
+
it 'flushes to joined cache to the file and clears it' do
|
75
|
+
@indexer.process @source, @categories do |file|
|
76
|
+
file.path.should == 'spec/temp/index/test/test/text.prepared.txt'
|
77
|
+
end
|
78
|
+
end
|
25
79
|
end
|
80
|
+
|
26
81
|
end
|
27
82
|
|
28
83
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.17.
|
4
|
+
version: 4.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Hanke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.17.
|
47
|
+
version: 4.17.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.17.
|
54
|
+
version: 4.17.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: text
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|