xapian-full-alaveteli 1.4.11.1 → 1.4.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -2
- data/lib/xapian.rb +149 -78
- data/xapian-bindings-1.4.19.tar.xz +0 -0
- data/xapian-core-1.4.19.tar.xz +0 -0
- data/xapian-full.gemspec +5 -5
- metadata +6 -6
- data/xapian-bindings-1.4.11.tar.xz +0 -0
- data/xapian-core-1.4.11.tar.xz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e8fed588da19179cb47ae5ee05007518161378d565a13b0f3e8a06f573d6043
|
4
|
+
data.tar.gz: 298ab3b30d670a916bdb27ccc84ea33b53c7cc8be620f5a3a4a8b7f545f6cbc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa31414a74c2872da5153446fba5ca7254be76143ac112be83471c0aa8473ef53adc656c96868e17443b1ed6692492b875fc19ff187d46f8ca3c55e2bc002807
|
7
|
+
data.tar.gz: 194d4cf6e791abbe1122c42becd6e6512ee4f1f4b62e1a6fdceac5107fb2ebfa77d6b1ec2e8fee5aa6d757ffc3865922353f0238f6606db0054bf4d8f00e99aa
|
data/Rakefile
CHANGED
@@ -13,7 +13,8 @@ def system!(cmd)
|
|
13
13
|
system(cmd) or raise
|
14
14
|
end
|
15
15
|
|
16
|
-
ver = '1.4.
|
16
|
+
ver = '1.4.19'
|
17
|
+
iter = '1'
|
17
18
|
core = "xapian-core-#{ver}"
|
18
19
|
bindings = "xapian-bindings-#{ver}"
|
19
20
|
|
@@ -37,7 +38,7 @@ task :default do
|
|
37
38
|
if have_bundler
|
38
39
|
# Maybe Bundler is building us in a temporary directory, and will move us to
|
39
40
|
# the system ruby gems directory once built.
|
40
|
-
system! "make clean all LDFLAGS='-R#{Bundler.rubygems.gem_dir}/gems/xapian-full-alaveteli
|
41
|
+
system! "make clean all LDFLAGS='-R#{Bundler.rubygems.gem_dir}/gems/xapian-full-alaveteli-#{ver}.#{iter}/lib'"
|
41
42
|
else
|
42
43
|
system! "make clean all"
|
43
44
|
end
|
data/lib/xapian.rb
CHANGED
@@ -44,25 +44,27 @@ module Xapian
|
|
44
44
|
|
45
45
|
# iterate over two dangerous iterators (i.e. those that can cause segfaults
|
46
46
|
# if used improperly.)
|
47
|
-
#
|
47
|
+
# If block_given? then the results are fed to it one by one, otherwise the
|
48
|
+
# results are returned as an Array.
|
48
49
|
# Users should never need to use this method.
|
49
50
|
#
|
50
|
-
#
|
51
|
-
# underlying Iterator
|
52
|
-
def _safelyIterate(dangerousStart, dangerousEnd) #:nodoc:
|
53
|
-
retval = Array.new
|
54
|
-
|
51
|
+
# wrapper is a lambda that returns some appropriate Ruby object to wrap the
|
52
|
+
# results from the underlying Iterator
|
53
|
+
def _safelyIterate(dangerousStart, dangerousEnd, wrapper) #:nodoc:
|
55
54
|
item = dangerousStart
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
55
|
+
if block_given?
|
56
|
+
while not item.equals(dangerousEnd) do
|
57
|
+
yield wrapper.call(item)
|
58
|
+
item.next()
|
59
|
+
end
|
60
|
+
else
|
61
|
+
retval = Array.new
|
62
|
+
while not item.equals(dangerousEnd) do
|
63
|
+
retval.push(wrapper.call(item))
|
64
|
+
item.next()
|
65
|
+
end
|
66
|
+
return retval
|
67
|
+
end
|
66
68
|
end # _safelyIterate
|
67
69
|
module_function :_safelyIterate
|
68
70
|
|
@@ -143,16 +145,24 @@ module Xapian
|
|
143
145
|
#--
|
144
146
|
# Extend Xapian::Document with a nice wrapper for its nasty input_iterators
|
145
147
|
class Xapian::Document
|
146
|
-
def terms
|
147
|
-
Xapian._safelyIterate(self._dangerous_termlist_begin(),
|
148
|
-
|
149
|
-
|
148
|
+
def terms(&block)
|
149
|
+
Xapian._safelyIterate(self._dangerous_termlist_begin(),
|
150
|
+
self._dangerous_termlist_end(),
|
151
|
+
lambda {
|
152
|
+
|item| Xapian::Term.new(item.term, item.wdf)
|
153
|
+
},
|
154
|
+
&block)
|
150
155
|
end # terms
|
151
156
|
|
152
|
-
def values
|
153
|
-
Xapian._safelyIterate(self._dangerous_values_begin(),
|
154
|
-
|
155
|
-
|
157
|
+
def values(&block)
|
158
|
+
Xapian._safelyIterate(self._dangerous_values_begin(),
|
159
|
+
self._dangerous_values_end(),
|
160
|
+
lambda {
|
161
|
+
|item| Xapian::Value.new(item.value,
|
162
|
+
item.valueno,
|
163
|
+
0)
|
164
|
+
},
|
165
|
+
&block)
|
156
166
|
end # values
|
157
167
|
|
158
168
|
end # class Xapian::Document
|
@@ -163,12 +173,25 @@ module Xapian
|
|
163
173
|
#--
|
164
174
|
# Extend Xapian::Query with a nice wrapper for its dangerous iterators
|
165
175
|
class Xapian::Query
|
166
|
-
def terms
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
176
|
+
def terms(&block)
|
177
|
+
# termfreq is not supported by TermIterators from Queries
|
178
|
+
Xapian._safelyIterate(self._dangerous_terms_begin(),
|
179
|
+
self._dangerous_terms_end(),
|
180
|
+
lambda {
|
181
|
+
|item| Xapian::Term.new(item.term, item.wdf)
|
182
|
+
},
|
183
|
+
&block)
|
171
184
|
end # terms
|
185
|
+
|
186
|
+
def unique_terms(&block)
|
187
|
+
# termfreq is not supported by TermIterators from Queries
|
188
|
+
Xapian._safelyIterate(self._dangerous_unique_terms_begin(),
|
189
|
+
self._dangerous_unique_terms_end(),
|
190
|
+
lambda {
|
191
|
+
|item| Xapian::Term.new(item.term, item.wdf)
|
192
|
+
},
|
193
|
+
&block)
|
194
|
+
end # unique_terms
|
172
195
|
end # Xapian::Query
|
173
196
|
|
174
197
|
# Refer to the
|
@@ -179,11 +202,11 @@ module Xapian
|
|
179
202
|
class Xapian::Enquire
|
180
203
|
# Get matching terms for some document.
|
181
204
|
# document can be either a Xapian::DocID or a Xapian::MSetIterator
|
182
|
-
def matching_terms(document)
|
205
|
+
def matching_terms(document, &block)
|
183
206
|
Xapian._safelyIterate(self._dangerous_matching_terms_begin(document),
|
184
|
-
self._dangerous_matching_terms_end(document)
|
185
|
-
|
186
|
-
|
207
|
+
self._dangerous_matching_terms_end(document),
|
208
|
+
lambda { |item| Xapian::Term.new(item.term, item.wdf) },
|
209
|
+
&block)
|
187
210
|
end # matching_terms
|
188
211
|
end # Xapian::Enquire
|
189
212
|
|
@@ -194,12 +217,11 @@ module Xapian
|
|
194
217
|
# MSetIterators are not dangerous, just inconvenient to use within a Ruby
|
195
218
|
# programming idiom. So we wrap them.
|
196
219
|
class Xapian::MSet
|
197
|
-
def matches
|
220
|
+
def matches(&block)
|
198
221
|
Xapian._safelyIterate(self._begin(),
|
199
|
-
self._end()
|
200
|
-
|
201
|
-
|
202
|
-
|
222
|
+
self._end(),
|
223
|
+
lambda { |item| Xapian::Match.new(item.docid, item.document, item.rank, item.weight, item.collapse_count, item.percent) },
|
224
|
+
&block)
|
203
225
|
end # matches
|
204
226
|
end # Xapian::MSet
|
205
227
|
|
@@ -210,14 +232,13 @@ module Xapian
|
|
210
232
|
# ESetIterators are not dangerous, just inconvenient to use within a Ruby
|
211
233
|
# programming idiom. So we wrap them.
|
212
234
|
class Xapian::ESet
|
213
|
-
def terms
|
235
|
+
def terms(&block)
|
236
|
+
# note: in the ExpandTerm wrapper, we implicitly rename
|
237
|
+
# ESetIterator#term() (defined in xapian-headers.i) to ExpandTerm#term()
|
214
238
|
Xapian._safelyIterate(self._begin(),
|
215
|
-
self._end()
|
216
|
-
|
217
|
-
|
218
|
-
Xapian::ExpandTerm.new(item.term, item.weight)
|
219
|
-
}
|
220
|
-
|
239
|
+
self._end(),
|
240
|
+
lambda { |item| Xapian::ExpandTerm.new(item.term, item.weight) },
|
241
|
+
&block)
|
221
242
|
end # terms
|
222
243
|
end # Xapian::ESet
|
223
244
|
|
@@ -246,47 +267,79 @@ module Xapian
|
|
246
267
|
# Wrap some dangerous iterators.
|
247
268
|
class Xapian::Database
|
248
269
|
# Returns an Array of all Xapian::Terms for this database.
|
249
|
-
def allterms(pref = '')
|
270
|
+
def allterms(pref = '', &block)
|
250
271
|
Xapian._safelyIterate(self._dangerous_allterms_begin(pref),
|
251
|
-
self._dangerous_allterms_end(pref)
|
252
|
-
|
253
|
-
|
272
|
+
self._dangerous_allterms_end(pref),
|
273
|
+
lambda { |item| Xapian::Term.new(item.term, 0, item.termfreq) },
|
274
|
+
&block)
|
254
275
|
end # allterms
|
255
276
|
|
277
|
+
# Returns an Array of all metadata keys for this database.
|
278
|
+
def metadata_keys(pref = '', &block)
|
279
|
+
Xapian._safelyIterate(self._dangerous_metadata_keys_begin(pref),
|
280
|
+
self._dangerous_metadata_keys_end(pref),
|
281
|
+
lambda { |item| item.term },
|
282
|
+
&block)
|
283
|
+
end # metadata_keys
|
284
|
+
|
256
285
|
# Returns an Array of Xapian::Postings for the given term.
|
257
286
|
# term is a string.
|
258
|
-
def postlist(term)
|
287
|
+
def postlist(term, &block)
|
259
288
|
Xapian._safelyIterate(self._dangerous_postlist_begin(term),
|
260
|
-
self._dangerous_postlist_end(term)
|
261
|
-
|
262
|
-
|
289
|
+
self._dangerous_postlist_end(term),
|
290
|
+
lambda { |item| Xapian::Posting.new(item.docid, item.doclength, item.wdf) },
|
291
|
+
&block)
|
263
292
|
end # postlist(term)
|
264
293
|
|
265
294
|
# Returns an Array of Terms for the given docid.
|
266
|
-
def termlist(docid)
|
295
|
+
def termlist(docid, &block)
|
267
296
|
Xapian._safelyIterate(self._dangerous_termlist_begin(docid),
|
268
|
-
self._dangerous_termlist_end(docid)
|
269
|
-
|
270
|
-
|
297
|
+
self._dangerous_termlist_end(docid),
|
298
|
+
lambda { |item| Xapian::Term.new(item.term, item.wdf, item.termfreq) },
|
299
|
+
&block)
|
271
300
|
end # termlist(docid)
|
272
301
|
|
273
|
-
# Returns an Array of
|
302
|
+
# Returns an Array of term positions for the given term (a String)
|
274
303
|
# in the given docid.
|
275
|
-
def positionlist(docid, term)
|
304
|
+
def positionlist(docid, term, &block)
|
276
305
|
Xapian._safelyIterate(self._dangerous_positionlist_begin(docid, term),
|
277
|
-
self._dangerous_positionlist_end(docid, term)
|
278
|
-
|
279
|
-
|
306
|
+
self._dangerous_positionlist_end(docid, term),
|
307
|
+
lambda { |item| item.termpos },
|
308
|
+
&block)
|
280
309
|
end # positionlist
|
281
310
|
|
282
311
|
# Returns an Array of Xapian::Value objects for the given slot in the
|
283
312
|
# database.
|
284
|
-
def valuestream(slot)
|
313
|
+
def valuestream(slot, &block)
|
285
314
|
Xapian._safelyIterate(self._dangerous_valuestream_begin(slot),
|
286
|
-
self._dangerous_valuestream_end(slot)
|
287
|
-
|
288
|
-
|
315
|
+
self._dangerous_valuestream_end(slot),
|
316
|
+
lambda { |item| Xapian::Value.new(item.value, slot, item.docid) },
|
317
|
+
&block)
|
289
318
|
end # valuestream(slot)
|
319
|
+
|
320
|
+
# Returns an Array of Xapian::Term objects for the spelling dictionary.
|
321
|
+
def spellings(&block)
|
322
|
+
Xapian._safelyIterate(self._dangerous_spellings_begin(),
|
323
|
+
self._dangerous_spellings_end(),
|
324
|
+
lambda { |item| Xapian::Term.new(item.term, 0, item.termfreq) },
|
325
|
+
&block)
|
326
|
+
end # spellings
|
327
|
+
|
328
|
+
# Returns an Array of synonyms of the given term.
|
329
|
+
def synonyms(term, &block)
|
330
|
+
Xapian._safelyIterate(self._dangerous_synonyms_begin(term),
|
331
|
+
self._dangerous_synonyms_end(term),
|
332
|
+
lambda { |item| item.term },
|
333
|
+
&block)
|
334
|
+
end # synonyms
|
335
|
+
|
336
|
+
# Returns an Array of terms with synonyms.
|
337
|
+
def synonym_keys(&block)
|
338
|
+
Xapian._safelyIterate(self._dangerous_synonym_keys_begin(),
|
339
|
+
self._dangerous_synonym_keys_end(),
|
340
|
+
lambda { |item| item.term },
|
341
|
+
&block)
|
342
|
+
end # synonym_keys
|
290
343
|
end # Xapian::Database
|
291
344
|
|
292
345
|
# Refer to the
|
@@ -296,19 +349,19 @@ module Xapian
|
|
296
349
|
# Wrap some dangerous iterators.
|
297
350
|
class Xapian::ValueCountMatchSpy
|
298
351
|
# Returns an Array of all the values seen, in alphabetical order
|
299
|
-
def values()
|
352
|
+
def values(&block)
|
300
353
|
Xapian._safelyIterate(self._dangerous_values_begin(),
|
301
|
-
self._dangerous_values_end()
|
302
|
-
|
303
|
-
|
354
|
+
self._dangerous_values_end(),
|
355
|
+
lambda { |item| Xapian::Term.new(item.term, 0, item.termfreq) },
|
356
|
+
&block)
|
304
357
|
end # values
|
305
358
|
|
306
359
|
# Returns an Array of the top values seen, by frequency
|
307
|
-
def top_values(maxvalues)
|
360
|
+
def top_values(maxvalues, &block)
|
308
361
|
Xapian._safelyIterate(self._dangerous_top_values_begin(maxvalues),
|
309
|
-
self._dangerous_top_values_end(maxvalues)
|
310
|
-
|
311
|
-
|
362
|
+
self._dangerous_top_values_end(maxvalues),
|
363
|
+
lambda { |item| Xapian::Term.new(item.term, 0, item.termfreq) },
|
364
|
+
&block)
|
312
365
|
end # top_values
|
313
366
|
end # Xapian::Database
|
314
367
|
|
@@ -319,14 +372,32 @@ module Xapian
|
|
319
372
|
# Wrap some dangerous iterators.
|
320
373
|
class Xapian::LatLongCoords
|
321
374
|
# Returns an Array of all the values seen, in alphabetical order
|
322
|
-
def all()
|
375
|
+
def all(&block)
|
323
376
|
Xapian._safelyIterate(self._begin(),
|
324
|
-
self._end()
|
325
|
-
|
326
|
-
|
377
|
+
self._end(),
|
378
|
+
lambda { |item| item.get_coord() },
|
379
|
+
&block)
|
327
380
|
end # allterms
|
328
381
|
end # Xapian::LatLongCoords
|
329
382
|
|
383
|
+
class Xapian::QueryParser
|
384
|
+
# Returns an Array of all words in the query ignored as stopwords.
|
385
|
+
def stoplist(&block)
|
386
|
+
Xapian._safelyIterate(self._dangerous_stoplist_begin(),
|
387
|
+
self._dangerous_stoplist_end(),
|
388
|
+
lambda { |item| item.term },
|
389
|
+
&block)
|
390
|
+
end # stoplist
|
391
|
+
|
392
|
+
# Returns an Array of all words in the query which stem to a given term.
|
393
|
+
def unstem(term, &block)
|
394
|
+
Xapian._safelyIterate(self._dangerous_unstem_begin(term),
|
395
|
+
self._dangerous_unstem_end(term),
|
396
|
+
lambda { |item| item.term },
|
397
|
+
&block)
|
398
|
+
end # unstem
|
399
|
+
end # Xapian::QueryParser
|
400
|
+
|
330
401
|
# Compatibility wrapping for Xapian::BAD_VALUENO (wrapped as a constant since
|
331
402
|
# xapian-bindings 1.4.10).
|
332
403
|
def Xapian::BAD_VALUENO()
|
Binary file
|
Binary file
|
data/xapian-full.gemspec
CHANGED
@@ -2,25 +2,25 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{xapian-full-alaveteli}
|
5
|
-
s.version = "1.4.
|
5
|
+
s.version = "1.4.19.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Tom Adams", "Rich Lane", "Seb Bacon", "Alexey Pisarenko", "Louise Crow", "Ian Chard", "Sam Pearson"]
|
9
9
|
s.homepage = %q{https://github.com/mysociety/xapian-full}
|
10
|
-
s.date = %q{
|
10
|
+
s.date = %q{2022-12-06}
|
11
11
|
s.description = %q{Xapian bindings for Ruby without dependency on system Xapian library}
|
12
12
|
s.email = %q{mysociety@alaveteli.org}
|
13
13
|
s.extensions = ["Rakefile"]
|
14
14
|
s.files = [
|
15
15
|
"lib/xapian.rb",
|
16
16
|
"Rakefile",
|
17
|
-
"xapian-bindings-1.4.
|
18
|
-
"xapian-core-1.4.
|
17
|
+
"xapian-bindings-1.4.19.tar.xz",
|
18
|
+
"xapian-core-1.4.19.tar.xz",
|
19
19
|
"xapian-full.gemspec",
|
20
20
|
]
|
21
21
|
s.rdoc_options = ["--charset=UTF-8"]
|
22
22
|
s.require_paths = ["lib"]
|
23
|
-
s.required_ruby_version = ">= 2.
|
23
|
+
s.required_ruby_version = ">= 2.7.0"
|
24
24
|
s.summary = %q{xapian-core + Ruby xapian-bindings}
|
25
25
|
|
26
26
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xapian-full-alaveteli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.19.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Adams
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
17
|
+
date: 2022-12-06 00:00:00.000000000 Z
|
18
18
|
dependencies: []
|
19
19
|
description: Xapian bindings for Ruby without dependency on system Xapian library
|
20
20
|
email: mysociety@alaveteli.org
|
@@ -25,8 +25,8 @@ extra_rdoc_files: []
|
|
25
25
|
files:
|
26
26
|
- Rakefile
|
27
27
|
- lib/xapian.rb
|
28
|
-
- xapian-bindings-1.4.
|
29
|
-
- xapian-core-1.4.
|
28
|
+
- xapian-bindings-1.4.19.tar.xz
|
29
|
+
- xapian-core-1.4.19.tar.xz
|
30
30
|
- xapian-full.gemspec
|
31
31
|
homepage: https://github.com/mysociety/xapian-full
|
32
32
|
licenses: []
|
@@ -40,14 +40,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 2.
|
43
|
+
version: 2.7.0
|
44
44
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0'
|
49
49
|
requirements: []
|
50
|
-
rubygems_version: 3.0.3
|
50
|
+
rubygems_version: 3.0.3.1
|
51
51
|
signing_key:
|
52
52
|
specification_version: 3
|
53
53
|
summary: xapian-core + Ruby xapian-bindings
|
Binary file
|
data/xapian-core-1.4.11.tar.xz
DELETED
Binary file
|