indexer101 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67c8317bb311f9715b5bbef8c325b7e0e76cf44cc7d1d83c5543f1758b67f9b2
4
- data.tar.gz: 87c825fb9af605084589749fde1e8b07464c8e7d9cf7713f40e5e49351e4171e
3
+ metadata.gz: 7c44c75f333aede7455b835b40bf64d518200bc5fb957050015b3a3b0b2ad7d9
4
+ data.tar.gz: 1846323dc390c84218f75a7f0933636b0feefdf1ab80df4a3a093d34c2119cf4
5
5
  SHA512:
6
- metadata.gz: 737e4933056905d48a68c0a42997ab19a465b37008cafde631370b5505c4adbe1f2a7fe10c3a763daba2e9d4505e44432d4118ea2acb5b7cf0399c8c886d36fc
7
- data.tar.gz: 13478e980d89771fa0014c8ad2b0a7d866ac3139f8fe39ef9f69d59e543b97d031d78567b6fc1a5507bffb450a785be39f8d5761712fb1493d06510a078ed8e2
6
+ metadata.gz: a6f0276cf0a8ed7e547a19c3e230aa2b304652e561873db5ae085241d19015fb322678ae3115ae6f470a9a5a4129496216f45d6da73a361bbdfb1882ba689d26
7
+ data.tar.gz: 87923aa4206e3a1de391ae6594fed0df2fc7c3b9dcc1295404e8c2a560ca9d03c418d01f90fc48dd1e771b3345476921acd5b34dab5586fbe8ed74e7ccc15877
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/indexer101.rb CHANGED
@@ -127,12 +127,20 @@ class Indexer101
127
127
  threads = locations.flatten.map do |location|
128
128
 
129
129
  Thread.new {
130
-
131
- Thread.current[:v] = case File.extname(location)
132
- when '.xml'
133
- Dynarex.new location
134
- when '.json'
135
- DxLite.new location
130
+
131
+ if location.is_a?(Dynarex) or location.is_a?(DxLite) then
132
+
133
+ Thread.current[:v] = location
134
+
135
+ elsif location.is_a? String
136
+
137
+ case File.extname(location)
138
+ when '.xml'
139
+ Thread.current[:v] = Dynarex.new location, debug: @debug
140
+ when '.json'
141
+ Thread.current[:v] = DxLite.new location, debug: @debug
142
+ end
143
+
136
144
  end
137
145
  }
138
146
  end
@@ -140,7 +148,7 @@ class Indexer101
140
148
  ThreadsWait.all_waits(*threads)
141
149
 
142
150
  a = threads.map {|x| x[:v]}
143
-
151
+ puts '_a: ' + a.inspect if @debug
144
152
  t2 = Time.now - t
145
153
  puts ("dxindex documents loaded in " + ("%.2f" % t2).brown \
146
154
  + " seconds").info
@@ -152,6 +160,11 @@ class Indexer101
152
160
 
153
161
  id2 = id
154
162
 
163
+ if @debug then
164
+ puts 'dx: ' + dx.class.inspect
165
+ puts 'dx.all: ' + dx.all.inspect
166
+ end
167
+
155
168
  @indexer.uri_index.merge! Hash[dx.all.reverse.map.with_index \
156
169
  {|x,i| [id+i, [Time.parse(x.created), x.title, x.url]]}]
157
170
 
@@ -167,7 +180,8 @@ class Indexer101
167
180
 
168
181
  when 1
169
182
 
170
- x.title.split(/[\s:"!\?\(\)£]+(?=[\w#_'-]+)/).each do |keyword|
183
+ # \u{A3} = £ <- represented as Unicode to avoid ASCII to UTF-8 error
184
+ x.title.split(/[\s:"!\?\(\)\u{A3}]+(?=[\w#_'-]+)/).each do |keyword|
171
185
  @indexer.index[keyword.downcase.to_sym] ||= []
172
186
  @indexer.index[keyword.downcase.to_sym] << id2
173
187
  end
@@ -214,7 +228,7 @@ class Indexer101
214
228
 
215
229
  # enter the exact keywords to search from the index
216
230
  #
217
- def search(*keywords)
231
+ def search(*keywords, minchars: 3)
218
232
 
219
233
  t = Time.now
220
234
 
@@ -223,7 +237,7 @@ class Indexer101
223
237
  a = []
224
238
  a += @indexer.index[x.to_sym].reverse if @indexer.index.has_key? x.to_sym
225
239
 
226
- if x.length > 3 then
240
+ if x.length >= minchars then
227
241
  a += @indexer.index.keys.grep(/^#{x}/i).flat_map\
228
242
  {|y| @indexer.index[y].reverse}
229
243
  a += @indexer.index.keys.grep(/#{x}/i).flat_map\
data.tar.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- � ���ib�^[�[��2v�^��<-~�Z≎xsF����1����)ܾ(��bOh���8��㜶��A1�]�����c�y�w�f�Y:�}�&���!<m�+B
2
- �>�ϭ�^š��Rńu����e�Ε�`��S�e�W1%�?��j��@8�~�j��:���߸��M���c*.-)�q�i�&}�J�t$�'�ĊW���r��y�MI&�(v8����:�t�@Z���A��1
3
- ���ڢ�=Ew��~j�jU7�5��K�X ;��̷���>���[����
1
+ 8z�m�B �D��0����嚶�0��r5=����UC��Gߩ��cK�}g���ɂXLOc���xG
2
+ �!��'��y\�E��J��Q�x
3
+ ��H��H���Y}��P=� ����q~N��
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indexer101
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -11,74 +11,94 @@ cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
- YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkxMTExMjI1NjA5WhcN
15
- MjAxMTEwMjI1NjA5WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
- cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDEF92R
17
- JWEWjPhgU6nIiCKKXtWI9EE8DbqPtU+CnYuUN2BWN7c4dsbaYrU1tVMzxx22G+Of
18
- apTIeIGFrq/oqub6nhx+UbnkMAqpmbJS8zTgnwEhFsGHGI2CD9+4OXh5rl36SqqP
19
- IGxY7w45KDvuPWA/Htb2aC20cHclJebOjeaMNogpYDByVEjjxtZeiOmIJtJlQSf+
20
- YpUviQVTkFJqbSK0WkKsPLQZu29P1zHETkdBvIGlGGDdo13haBW2Hdj9a2INeWcz
21
- B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M2Y0OfjOIzKLf4jeLzcR0XjxCS9bH
31
+ g3cF/0FdJ5ydwo6r9QW/mE5yej6yuWBD9NFjWVbV/TAY3rWWDtw9g1WG31HjZVRB
32
+ lYndPAx0WIUBse5IRDGTiQ1JuMI5vBrxYJCb1Je506nR2rktACDRVSe/DTM4sxZn
33
+ oP3LBd1hPOAhNya8tD4FmUjQg4tvuWwIKh55XorZVEkzTWGgAJSnu7XTxtPcjxFA
34
+ U/3nmRr1BTYMN96T+3L81oqJTW5CxAAlsR97O7H8eZhwnNdG9HjgAk4PwiMLOhPb
35
+ Ely2/UitUG79uLcra+83gWVYzYiqBYC2d5HR4vCpTeecqYFXjWo9E3LMrvyB5Unk
36
+ zn10wjI+T1ysW7U6t+VJft8s
37
37
  -----END CERTIFICATE-----
38
- date: 2020-06-23 00:00:00.000000000 Z
38
+ date: 2022-01-25 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: dynarex
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '1.8'
47
44
  - - ">="
48
45
  - !ruby/object:Gem::Version
49
- version: 1.8.21
46
+ version: 1.9.0
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.9'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - "~>"
55
- - !ruby/object:Gem::Version
56
- version: '1.8'
57
54
  - - ">="
58
55
  - !ruby/object:Gem::Version
59
- version: 1.8.21
56
+ version: 1.9.0
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.9'
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: dxlite
62
62
  requirement: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '0.2'
66
+ version: '0.4'
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 0.2.7
69
+ version: 0.4.1
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '0.4'
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 0.4.1
80
+ - !ruby/object:Gem::Dependency
81
+ name: thwait
82
+ requirement: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 0.2.0
74
87
  - - "~>"
75
88
  - !ruby/object:Gem::Version
76
89
  version: '0.2'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
77
94
  - - ">="
78
95
  - !ruby/object:Gem::Version
79
- version: 0.2.7
96
+ version: 0.2.0
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.2'
80
100
  description:
81
- email: james@jamesrobertson.eu
101
+ email: digital.robertson@gmail.com
82
102
  executables: []
83
103
  extensions: []
84
104
  extra_rdoc_files: []
metadata.gz.sig CHANGED
Binary file