xapian-fu 1.5.3 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +6 -14
  2. data/CHANGELOG.rdoc +10 -0
  3. data/LICENSE +1 -1
  4. data/examples/ar_query.rb +34 -0
  5. data/examples/ar_spider.rb +36 -0
  6. data/lib/xapian_fu/version.rb +1 -1
  7. data/lib/xapian_fu/xapian_db.rb +31 -0
  8. data/lib/xapian_fu/xapian_doc.rb +12 -2
  9. data/lib/xapian_fu/xapian_doc_value_accessor.rb +20 -15
  10. data/lib/xapian_fu/xapian_documents_accessor.rb +2 -2
  11. data/spec/build_db_for_value_testing.rb +2 -2
  12. data/spec/fixtures/film_data/{i486-linux~1.8.7 → x86_64-linux-gnu~2.5.5}/flintlock +0 -0
  13. data/spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/iamchert +1 -0
  14. data/spec/fixtures/film_data/{x86_64-linux~1.9.1 → x86_64-linux-gnu~2.5.5}/position.DB +0 -0
  15. data/spec/fixtures/film_data/{i486-linux~1.8.7 → x86_64-linux-gnu~2.5.5}/position.baseA +0 -0
  16. data/spec/fixtures/film_data/{i486-linux~1.8.7 → x86_64-linux-gnu~2.5.5}/position.baseB +0 -0
  17. data/spec/fixtures/film_data/{i486-linux~1.8.7 → x86_64-linux-gnu~2.5.5}/postlist.DB +0 -0
  18. data/spec/fixtures/film_data/{i486-linux~1.8.7 → x86_64-linux-gnu~2.5.5}/postlist.baseA +0 -0
  19. data/spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/postlist.baseB +0 -0
  20. data/spec/fixtures/film_data/{x86_64-linux~1.9.1 → x86_64-linux-gnu~2.5.5}/record.DB +0 -0
  21. data/spec/fixtures/film_data/{i486-linux~1.8.7 → x86_64-linux-gnu~2.5.5}/record.baseA +0 -0
  22. data/spec/fixtures/film_data/{i486-linux~1.8.7 → x86_64-linux-gnu~2.5.5}/record.baseB +0 -0
  23. data/spec/fixtures/film_data/{i486-linux~1.8.7/record.DB → x86_64-linux-gnu~2.5.5/spelling.DB} +0 -0
  24. data/spec/fixtures/film_data/{i486-linux~1.8.7/termlist.baseA → x86_64-linux-gnu~2.5.5/spelling.baseA} +0 -0
  25. data/spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/spelling.baseB +0 -0
  26. data/spec/fixtures/film_data/{x86_64-linux~1.9.1 → x86_64-linux-gnu~2.5.5}/termlist.DB +0 -0
  27. data/spec/fixtures/film_data/{x86_64-linux~1.9.1 → x86_64-linux-gnu~2.5.5}/termlist.baseA +0 -0
  28. data/spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/termlist.baseB +0 -0
  29. data/spec/fixtures/film_data/x86_64-linux~1.8.7/iamchert +1 -0
  30. data/spec/fixtures/film_data/x86_64-linux~1.8.7/position.DB +0 -0
  31. data/spec/fixtures/film_data/x86_64-linux~1.8.7/postlist.DB +0 -0
  32. data/spec/fixtures/film_data/x86_64-linux~1.8.7/postlist.baseB +0 -0
  33. data/spec/fixtures/film_data/x86_64-linux~1.8.7/record.DB +0 -0
  34. data/spec/fixtures/film_data/{i486-linux~1.8.7/termlist.DB → x86_64-linux~1.8.7/spelling.DB} +0 -0
  35. data/spec/fixtures/film_data/{i486-linux~1.8.7/value.baseA → x86_64-linux~1.8.7/spelling.baseA} +0 -0
  36. data/spec/fixtures/film_data/x86_64-linux~1.8.7/spelling.baseB +0 -0
  37. data/spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.DB +0 -0
  38. data/spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.baseB +0 -0
  39. data/spec/fixtures/film_data/{x86_64-linux~1.9.1 → x86_64-linux~1.9.3}/flintlock +0 -0
  40. data/spec/fixtures/film_data/x86_64-linux~1.9.3/iamchert +1 -0
  41. data/spec/fixtures/film_data/x86_64-linux~1.9.3/position.DB +0 -0
  42. data/spec/fixtures/film_data/x86_64-linux~1.9.3/position.baseA +0 -0
  43. data/spec/fixtures/film_data/{x86_64-linux~1.9.1 → x86_64-linux~1.9.3}/position.baseB +0 -0
  44. data/spec/fixtures/film_data/x86_64-linux~1.9.3/postlist.DB +0 -0
  45. data/spec/fixtures/film_data/x86_64-linux~1.9.3/postlist.baseA +0 -0
  46. data/spec/fixtures/film_data/x86_64-linux~1.9.3/postlist.baseB +0 -0
  47. data/spec/fixtures/film_data/x86_64-linux~1.9.3/record.DB +0 -0
  48. data/spec/fixtures/film_data/x86_64-linux~1.9.3/record.baseA +0 -0
  49. data/spec/fixtures/film_data/{x86_64-linux~1.9.1 → x86_64-linux~1.9.3}/record.baseB +0 -0
  50. data/spec/fixtures/film_data/x86_64-linux~1.9.3/spelling.DB +0 -0
  51. data/spec/fixtures/film_data/x86_64-linux~1.9.3/spelling.baseA +0 -0
  52. data/spec/fixtures/film_data/x86_64-linux~1.9.3/spelling.baseB +0 -0
  53. data/spec/fixtures/film_data/x86_64-linux~1.9.3/termlist.DB +0 -0
  54. data/spec/fixtures/film_data/x86_64-linux~1.9.3/termlist.baseA +0 -0
  55. data/spec/fixtures/film_data/x86_64-linux~1.9.3/termlist.baseB +0 -0
  56. data/spec/xapian_doc_spec.rb +28 -0
  57. data/spec/xapian_doc_value_accessor_spec.rb +21 -0
  58. metadata +126 -123
  59. data/lib/xapian_fu/posting_source.rb +0 -47
  60. data/spec/fixtures/film_data/i486-linux~1.8.7/iamflint +0 -0
  61. data/spec/fixtures/film_data/i486-linux~1.8.7/position.DB +0 -0
  62. data/spec/fixtures/film_data/i486-linux~1.8.7/postlist.baseB +0 -0
  63. data/spec/fixtures/film_data/i486-linux~1.8.7/termlist.baseB +0 -0
  64. data/spec/fixtures/film_data/i486-linux~1.8.7/value.DB +0 -0
  65. data/spec/fixtures/film_data/i486-linux~1.8.7/value.baseB +0 -0
  66. data/spec/fixtures/film_data/x86_64-linux~1.8.7/iamflint +0 -0
  67. data/spec/fixtures/film_data/x86_64-linux~1.8.7/value.DB +0 -0
  68. data/spec/fixtures/film_data/x86_64-linux~1.8.7/value.baseA +0 -0
  69. data/spec/fixtures/film_data/x86_64-linux~1.8.7/value.baseB +0 -0
  70. data/spec/fixtures/film_data/x86_64-linux~1.9.1/iamflint +0 -0
  71. data/spec/fixtures/film_data/x86_64-linux~1.9.1/position.baseA +0 -0
  72. data/spec/fixtures/film_data/x86_64-linux~1.9.1/postlist.DB +0 -0
  73. data/spec/fixtures/film_data/x86_64-linux~1.9.1/postlist.baseA +0 -0
  74. data/spec/fixtures/film_data/x86_64-linux~1.9.1/postlist.baseB +0 -0
  75. data/spec/fixtures/film_data/x86_64-linux~1.9.1/record.baseA +0 -0
  76. data/spec/fixtures/film_data/x86_64-linux~1.9.1/termlist.baseB +0 -0
  77. data/spec/fixtures/film_data/x86_64-linux~1.9.1/value.DB +0 -0
  78. data/spec/fixtures/film_data/x86_64-linux~1.9.1/value.baseA +0 -0
  79. data/spec/fixtures/film_data/x86_64-linux~1.9.1/value.baseB +0 -0
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YTU3ZmE1ZDAxMjgwZWQ1OTgzMDRlNGIwYWUwZTAyNmE3ODRlMTY3NQ==
5
- data.tar.gz: !binary |-
6
- OWYzOTNiYjVmOTMzZTVjNDZhYWU5MjQ1NDMzMzM3ZWM1OTlkMzA4NQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MTZhNWNjMmY1ZGI2ODIwNjM1ZTdmNTRjNjNjMzczYzNmOGY1OTg4NjA1NzM2
10
- N2E4MThmZDU2ZGRiYjFkYmJlMjg4NjExMmM3NGZlM2UzZmFhZWNlOTk3YTIy
11
- MTAzYmU3ZDA1ZjRiODk1OGY0ZTJkZWVhMDMyMjM3NjI4OWE0M2Y=
12
- data.tar.gz: !binary |-
13
- NmVlMzRlZGNlMmVjNjkwMjYzMzliNmM2OTY5MWE5ZjZkZDM1Y2QxMGU5OGI5
14
- NzU2M2MzYjkxYzljMWEwZGRmYjk0Mjc3MzY1ODlhNzdjMmFiMzg2ODZjZmYw
15
- MTJiYjc1ZTZjZTc5Nzk3NDgxZjFlOWZkMTU4ZmZhYjNjNmM3YjM=
2
+ SHA256:
3
+ metadata.gz: 97c807d9e1a6c4ce62f3565aaae147f9bca5f2c037ccd39b51d8fda583544451
4
+ data.tar.gz: 3e12b31653f3cc34914e13597f67af5c632e072fe622447c1da879b92be06ee4
5
+ SHA512:
6
+ metadata.gz: 47fda9c3e053b1c3e8dd8c9bfecca1ddba6499d9e35d49ad1a37d6b8e4b6710a8f28af88b7d1b4dd927132151df3811f520cdfac30ed8d1b96b3fe62c5abed04
7
+ data.tar.gz: 628fcdb102e4ab3ed4dcd4fe7832d7a9c15c681085c9bc87251d927e0db9dd305b400617217eaa97dec13bcf9fd73a26811c36e207aa6e9ef86d98a32c242137
@@ -1,3 +1,13 @@
1
+ === 1.6.0 (7th October 2019)
2
+
3
+ * Support newer versions of xapian
4
+ * Avoid Bignum/Fixnum deprecations under Ruby >= 2.4
5
+
6
+ === 1.5.4 (unreleased)
7
+
8
+ * Add ability to index field with or without field names
9
+ (:without_field_names, :with_field_names_only)
10
+
1
11
  === 1.5.3 (19th February 2015)
2
12
 
3
13
  * Added support for indexing multiple terms without stemming (`:exact`).
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  xapian_fu is released under the MIT License.
2
2
 
3
- Copyright (c) 2009 John Leach
3
+ Copyright (c) 2009-2019 John Leach
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of the acts_as_xapian software and associated documentation files (the
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'rubygems'
4
+ require 'benchmark'
5
+ require 'lib/xapian_fu'
6
+ include XapianFu
7
+ require 'active_record'
8
+
9
+ ActiveRecord::Base.establish_connection(
10
+ :adapter => "mysql",
11
+ :host => "localhost",
12
+ :username => "john",
13
+ :password => "john",
14
+ :database => "john_somedb_dev" )
15
+
16
+ class WpPost < ActiveRecord::Base
17
+ set_primary_key :ID
18
+ end
19
+
20
+ db = XapianDb.new(:dir => 'ar_spider.db')
21
+
22
+ results = nil
23
+ bm = Benchmark.measure do
24
+ results = db.search(ARGV.join(' '))
25
+ end
26
+
27
+ posts = WpPost.find(results.collect { |r| r.id })
28
+
29
+ puts "Weight\tTitle"
30
+ posts.each_with_index do |p,i|
31
+ puts "%.3f\t#{p.post_title}" % results[i].weight
32
+ end
33
+
34
+ puts "Search took %.5f seconds" % bm.total
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'rubygems'
4
+ require 'benchmark'
5
+ require 'lib/xapian_fu'
6
+ include XapianFu
7
+ require 'active_record'
8
+
9
+ ActiveRecord::Base.establish_connection(
10
+ :adapter => "mysql",
11
+ :host => "localhost",
12
+ :username => "john",
13
+ :password => "john",
14
+ :database => "john_somedb_dev" )
15
+
16
+ class WpPost < ActiveRecord::Base
17
+ set_primary_key :ID
18
+ end
19
+
20
+ db = XapianDb.new(:dir => 'ar_spider.db', :overwrite => true)
21
+
22
+ count = 0
23
+ indexing_time = 0.0
24
+ WpPost.find_in_batches do |posts|
25
+ db.transaction do
26
+ puts "Indexing wp_posts #{count} to #{count += posts.size}"
27
+ posts.each do |post|
28
+ bm = Benchmark.measure do
29
+ db << XapianDoc.new(post.attributes.merge({ :id => post.id }))
30
+ end
31
+ indexing_time += bm.total
32
+ end
33
+ end
34
+ indexing_time += Benchmark.measure { db.flush }.total
35
+ end
36
+ puts "%i documents took %.4f seconds. %.2f per second" % [count, indexing_time, count / indexing_time]
@@ -1,3 +1,3 @@
1
1
  module XapianFu #:nodoc:
2
- VERSION = "1.5.3"
2
+ VERSION = "1.6.0"
3
3
  end
@@ -98,6 +98,28 @@ module XapianFu #:nodoc:
98
98
  # and sort them efficiently (without having to resort to storing
99
99
  # leading zeros or anything like that).
100
100
  #
101
+ # == Indexing options
102
+ #
103
+ # If <tt>:index</tt> is <tt>false</tt>, then the field will not be tokenized,
104
+ # or stemmed or stopped. It will only be searchable by its entire exact
105
+ # contents. Useful for fields that only exact matches will make sense for,
106
+ # like slugs, identifiers or keys.
107
+ #
108
+ # If <tt>:index</tt> is <tt>true</tt> (the default) then the field will be
109
+ # tokenized, stemmed and stopped twice, once with the field name and once
110
+ # without. This allows you to do both search like "name:lily" and simply
111
+ # "lily", but it does require that the full text of the field content is
112
+ # indexed twice and will increase the size of your index on-disk.
113
+ #
114
+ # If you know you will never need to search the field using its field name,
115
+ # then you can set <tt>:index</tt> to <tt>:without_field_names</tt> and only
116
+ # one tokenization pass will be done, without the field names as token
117
+ # prefixes.
118
+ #
119
+ # If you know you will only ever search the field using its field name, then
120
+ # you can set <tt>:index</tt> to <tt>:with_field_names_only</tt> and only one
121
+ # tokenization pass will be done, with only the fieldnames as token prefixes.
122
+ #
101
123
  # == Term Weights
102
124
  #
103
125
  # The <tt>:weights</tt> option accepts a Proc or Lambda that sets
@@ -132,6 +154,11 @@ module XapianFu #:nodoc:
132
154
  attr_reader :fields
133
155
  # An array of fields that will not be indexed
134
156
  attr_reader :unindexed_fields
157
+ # An array of fields to be indexed without their field names
158
+ attr_reader :fields_without_field_names
159
+ # An array of fields to be indexed only with their field names
160
+ attr_reader :fields_with_field_names_only
161
+
135
162
  # An array of fields that will be treated as boolean terms
136
163
  attr_reader :boolean_fields
137
164
  # Whether this db will generate a spelling dictionary during indexing
@@ -412,6 +439,8 @@ module XapianFu #:nodoc:
412
439
  def setup_fields(field_options)
413
440
  @fields = { }
414
441
  @unindexed_fields = []
442
+ @fields_without_field_names = []
443
+ @fields_with_field_names_only = []
415
444
  @store_values = []
416
445
  @sortable_fields = {}
417
446
  @boolean_fields = []
@@ -443,6 +472,8 @@ module XapianFu #:nodoc:
443
472
  @store_values << name if opts[:store]
444
473
  @sortable_fields[name] = {:range_prefix => opts[:range_prefix], :range_postfix => opts[:range_postfix]} if opts[:sortable]
445
474
  @unindexed_fields << name if opts[:index] == false
475
+ @fields_without_field_names << name if opts[:index] == :without_field_names
476
+ @fields_with_field_names_only << name if opts[:index] == :with_field_names_only
446
477
  @boolean_fields << name if opts[:boolean]
447
478
  @fields[name] = opts[:type]
448
479
  @field_weights[name] = opts[:weight] if opts.include?(:weight)
@@ -251,6 +251,16 @@ module XapianFu #:nodoc:
251
251
  db ? db.unindexed_fields : []
252
252
  end
253
253
 
254
+ # Array of field names not to index with field names
255
+ def fields_without_field_names
256
+ db ? db.fields_without_field_names : []
257
+ end
258
+
259
+ # Array of field names to index with field names only
260
+ def fields_with_field_names_only
261
+ db ? db.fields_with_field_names_only : []
262
+ end
263
+
254
264
  # Add all the fields to be stored as XapianDb values
255
265
  def add_values_to_xapian_document
256
266
  db.store_values.collect do |key|
@@ -287,9 +297,9 @@ module XapianFu #:nodoc:
287
297
  # get the custom term weight if a weights function exists
288
298
  weight = db.weights_function ? db.weights_function.call(k, v, fields).to_i : db.field_weights[k]
289
299
  # add value with field name
290
- tg.send(index_method, v, weight, 'X' + k.to_s.upcase)
300
+ tg.send(index_method, v, weight, 'X' + k.to_s.upcase) unless fields_without_field_names.include?(k)
291
301
  # add value without field name
292
- tg.send(index_method, v, weight)
302
+ tg.send(index_method, v, weight) unless fields_with_field_names_only.include?(k)
293
303
 
294
304
  if db.field_options[k] && db.field_options[k][:exact]
295
305
  xapian_document.add_term("X#{k.to_s.upcase}#{v.to_s.downcase}", weight)
@@ -1,16 +1,6 @@
1
1
  require 'zlib'
2
2
 
3
3
  class Integer #:nodoc:
4
- def self.to_xapian_fu_storage_value(value)
5
- [value].pack("G")
6
- end
7
-
8
- def self.from_xapian_fu_storage_value(value)
9
- value.unpack("G").first.truncate rescue nil
10
- end
11
- end
12
-
13
- class Bignum #:nodoc:
14
4
  def self.to_xapian_fu_storage_value(value)
15
5
  if value > 0x1fffffffffffff or value < -0x1fffffffffffff
16
6
  raise XapianFu::ValueOutOfBounds
@@ -23,13 +13,28 @@ class Bignum #:nodoc:
23
13
  end
24
14
  end
25
15
 
26
- class Fixnum #:nodoc:
27
- def self.to_xapian_fu_storage_value(value)
28
- [value].pack("G")
16
+ if RUBY_VERSION < '2.4'
17
+ class Bignum #:nodoc:
18
+ def self.to_xapian_fu_storage_value(value)
19
+ if value > 0x1fffffffffffff or value < -0x1fffffffffffff
20
+ raise XapianFu::ValueOutOfBounds
21
+ end
22
+ [value].pack("G")
23
+ end
24
+
25
+ def self.from_xapian_fu_storage_value(value)
26
+ value.unpack("G").first.truncate rescue nil
27
+ end
29
28
  end
30
29
 
31
- def self.from_xapian_fu_storage_value(value)
32
- value.unpack("G").first.truncate rescue nil
30
+ class Fixnum #:nodoc:
31
+ def self.to_xapian_fu_storage_value(value)
32
+ [value].pack("G")
33
+ end
34
+
35
+ def self.from_xapian_fu_storage_value(value)
36
+ value.unpack("G").first.truncate rescue nil
37
+ end
33
38
  end
34
39
  end
35
40
 
@@ -69,11 +69,11 @@ module XapianFu
69
69
  # for :id we can use lastdocid
70
70
  find(@xdb.ro.lastdocid) rescue nil
71
71
  else
72
- # for other values, we do a search ordered by that key in descening order
72
+ # for other values, we do a search ordered by that key in descending order
73
73
  query = Xapian::Query.new(Xapian::Query::OP_VALUE_GE, XapianDocValueAccessor.value_key(key), "0")
74
74
  e = Xapian::Enquire.new(@xdb.ro)
75
75
  e.query = query
76
- e.sort_by_value!(XapianDocValueAccessor.value_key(key))
76
+ e.sort_by_value!(XapianDocValueAccessor.value_key(key), true)
77
77
  r = e.mset(0, 1).matches.first
78
78
  find(r.docid) rescue nil
79
79
  end
@@ -2,9 +2,9 @@
2
2
  #
3
3
 
4
4
  require 'date'
5
- require File.join(File.dirname(__FILE__), '../lib/xapian_fu')
5
+ require 'xapian_fu'
6
6
  include XapianFu
7
- require File.join(File.dirname(__FILE__), 'fixtures/film_data')
7
+ require_relative 'fixtures/film_data'
8
8
  require 'fileutils'
9
9
 
10
10
 
@@ -0,0 +1 @@
1
+ IAmChert�� �=�GM��l/�%E�
@@ -0,0 +1 @@
1
+ IAmChert�� �W>^g�N�W�O0%�s
@@ -0,0 +1 @@
1
+ IAmChert�� ɥ;��I��O� pW��
@@ -98,6 +98,34 @@ describe XapianDoc do
98
98
  terms.should_not include 'leach'
99
99
  end
100
100
 
101
+ it "should tokenize fields without field names for fields declared as such" do
102
+ xdb = XapianDb.new(:fields => { :name => { :index => :without_field_names } })
103
+ xdoc = xdb.documents.new({ :name => 'John Leach', :quote => 'Xapian Rocks' }).to_xapian_document
104
+ terms = xdoc.terms.collect { |t| t.term }
105
+ terms.should include 'john'
106
+ terms.should_not include 'XNAMEjohn'
107
+ terms.should include 'leach'
108
+ terms.should_not include 'XNAMEleach'
109
+ terms.should include 'xapian'
110
+ terms.should include 'XQUOTExapian'
111
+ terms.should include 'rocks'
112
+ terms.should include 'XQUOTErocks'
113
+ end
114
+
115
+ it "should tokenize fields exclusively with field names for fields declared as such" do
116
+ xdb = XapianDb.new(:fields => { :name => { :index => :with_field_names_only } })
117
+ xdoc = xdb.documents.new({ :name => 'John Leach', :quote => 'Xapian Rocks' }).to_xapian_document
118
+ terms = xdoc.terms.collect { |t| t.term }
119
+ terms.should_not include 'john'
120
+ terms.should include 'XNAMEjohn'
121
+ terms.should_not include 'leach'
122
+ terms.should include 'XNAMEleach'
123
+ terms.should include 'xapian'
124
+ terms.should include 'XQUOTExapian'
125
+ terms.should include 'rocks'
126
+ terms.should include 'XQUOTErocks'
127
+ end
128
+
101
129
  it "should convert Time instances to a useful format when tokenizing" do
102
130
  time = Time.now
103
131
  xdb = XapianDb.new
@@ -63,6 +63,27 @@ describe XapianDocValueAccessor do
63
63
  end
64
64
  end
65
65
 
66
+ it "should store fields defined as Integer as packed double-precision float, network byte order" do
67
+ xdb = XapianDb.new(:fields => { :number => { :type => Integer, :store => true } })
68
+ [
69
+ (-0x1fffffffffffff..-0x1fffffffffffff + 10).to_a,
70
+ (0x1fffffffffffff-10..0x1fffffffffffff).to_a
71
+ ].flatten.each do |number|
72
+ doc = xdb.documents.new(:number => number)
73
+ doc.values.store(:number, number, Integer).should == number
74
+ doc.values.fetch(:number, Integer).should == number
75
+ doc.to_xapian_document.values.first.value.should == [number].pack("G")
76
+ end
77
+ end
78
+
79
+ it "should raise an error when attempting to store Integer values bigger or smaller than can be stored" do
80
+ xdb = XapianDb.new(:fields => { :number => { :type => Integer, :store => true } })
81
+ [-(0x1fffffffffffff+1), 0x1fffffffffffff+1].each do |number|
82
+ doc = xdb.documents.new(:number => number)
83
+ lambda { doc.values.store(:number, number, Integer) }.should raise_error XapianFu::ValueOutOfBounds
84
+ end
85
+ end
86
+
66
87
  it "should store fields defined as Float as packed double-precision float, network byte order" do
67
88
  xdb = XapianDb.new(:fields => { :number => { :type => Float, :store => true } })
68
89
  [-0.303393984588383833, 8.448488388488384, 1.0].each do |number|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xapian-fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
@@ -9,50 +9,50 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-23 00:00:00.000000000 Z
12
+ date: 2019-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 2.7.0
20
+ version: '2.7'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 2.7.0
27
+ version: '2.7'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ! '>='
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ! '>='
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rdoc
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ! '>='
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
48
+ version: '4'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ! '>='
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: '4'
56
56
  description: A library to provide a more Ruby-like interface to the Xapian search
57
57
  engine.
58
58
  email: john@johnleach.co.uk
@@ -63,11 +63,19 @@ extra_rdoc_files:
63
63
  - LICENSE
64
64
  - CHANGELOG.rdoc
65
65
  files:
66
+ - CHANGELOG.rdoc
67
+ - LICENSE
68
+ - README.rdoc
69
+ - examples/ar_query.rb
70
+ - examples/ar_spider.rb
71
+ - examples/query.rb
72
+ - examples/spider.rb
66
73
  - lib/xapian-fu.rb
67
- - lib/xapian_fu/posting_source.rb
74
+ - lib/xapian_fu.rb
68
75
  - lib/xapian_fu/query_parser.rb
69
76
  - lib/xapian_fu/result_set.rb
70
77
  - lib/xapian_fu/stopper_factory.rb
78
+ - lib/xapian_fu/stopwords/README
71
79
  - lib/xapian_fu/stopwords/danish.txt
72
80
  - lib/xapian_fu/stopwords/dutch.txt
73
81
  - lib/xapian_fu/stopwords/english.txt
@@ -78,7 +86,6 @@ files:
78
86
  - lib/xapian_fu/stopwords/italian.txt
79
87
  - lib/xapian_fu/stopwords/norwegian.txt
80
88
  - lib/xapian_fu/stopwords/portuguese.txt
81
- - lib/xapian_fu/stopwords/README
82
89
  - lib/xapian_fu/stopwords/russian.txt
83
90
  - lib/xapian_fu/stopwords/spanish.txt
84
91
  - lib/xapian_fu/stopwords/swedish.txt
@@ -88,156 +95,152 @@ files:
88
95
  - lib/xapian_fu/xapian_doc.rb
89
96
  - lib/xapian_fu/xapian_doc_value_accessor.rb
90
97
  - lib/xapian_fu/xapian_documents_accessor.rb
91
- - lib/xapian_fu.rb
92
- - examples/query.rb
93
- - examples/spider.rb
94
- - README.rdoc
95
- - LICENSE
96
- - CHANGELOG.rdoc
97
98
  - spec/build_db_for_value_testing.rb
98
99
  - spec/facets_spec.rb
99
- - spec/fixtures/film_data/i486-linux~1.8.7/flintlock
100
- - spec/fixtures/film_data/i486-linux~1.8.7/iamflint
101
- - spec/fixtures/film_data/i486-linux~1.8.7/position.baseA
102
- - spec/fixtures/film_data/i486-linux~1.8.7/position.baseB
103
- - spec/fixtures/film_data/i486-linux~1.8.7/position.DB
104
- - spec/fixtures/film_data/i486-linux~1.8.7/postlist.baseA
105
- - spec/fixtures/film_data/i486-linux~1.8.7/postlist.baseB
106
- - spec/fixtures/film_data/i486-linux~1.8.7/postlist.DB
107
- - spec/fixtures/film_data/i486-linux~1.8.7/record.baseA
108
- - spec/fixtures/film_data/i486-linux~1.8.7/record.baseB
109
- - spec/fixtures/film_data/i486-linux~1.8.7/record.DB
110
- - spec/fixtures/film_data/i486-linux~1.8.7/termlist.baseA
111
- - spec/fixtures/film_data/i486-linux~1.8.7/termlist.baseB
112
- - spec/fixtures/film_data/i486-linux~1.8.7/termlist.DB
113
- - spec/fixtures/film_data/i486-linux~1.8.7/value.baseA
114
- - spec/fixtures/film_data/i486-linux~1.8.7/value.baseB
115
- - spec/fixtures/film_data/i486-linux~1.8.7/value.DB
100
+ - spec/fixtures/film_data.rb
101
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/flintlock
102
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/iamchert
103
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/position.DB
104
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/position.baseA
105
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/position.baseB
106
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/postlist.DB
107
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/postlist.baseA
108
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/postlist.baseB
109
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/record.DB
110
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/record.baseA
111
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/record.baseB
112
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/spelling.DB
113
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/spelling.baseA
114
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/spelling.baseB
115
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/termlist.DB
116
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/termlist.baseA
117
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/termlist.baseB
116
118
  - spec/fixtures/film_data/x86_64-linux~1.8.7/flintlock
117
- - spec/fixtures/film_data/x86_64-linux~1.8.7/iamflint
119
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/iamchert
120
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/position.DB
118
121
  - spec/fixtures/film_data/x86_64-linux~1.8.7/position.baseA
119
122
  - spec/fixtures/film_data/x86_64-linux~1.8.7/position.baseB
120
- - spec/fixtures/film_data/x86_64-linux~1.8.7/position.DB
123
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/postlist.DB
121
124
  - spec/fixtures/film_data/x86_64-linux~1.8.7/postlist.baseA
122
125
  - spec/fixtures/film_data/x86_64-linux~1.8.7/postlist.baseB
123
- - spec/fixtures/film_data/x86_64-linux~1.8.7/postlist.DB
126
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/record.DB
124
127
  - spec/fixtures/film_data/x86_64-linux~1.8.7/record.baseA
125
128
  - spec/fixtures/film_data/x86_64-linux~1.8.7/record.baseB
126
- - spec/fixtures/film_data/x86_64-linux~1.8.7/record.DB
129
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/spelling.DB
130
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/spelling.baseA
131
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/spelling.baseB
132
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.DB
127
133
  - spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.baseA
128
134
  - spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.baseB
129
- - spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.DB
130
- - spec/fixtures/film_data/x86_64-linux~1.8.7/value.baseA
131
- - spec/fixtures/film_data/x86_64-linux~1.8.7/value.baseB
132
- - spec/fixtures/film_data/x86_64-linux~1.8.7/value.DB
133
- - spec/fixtures/film_data/x86_64-linux~1.9.1/flintlock
134
- - spec/fixtures/film_data/x86_64-linux~1.9.1/iamflint
135
- - spec/fixtures/film_data/x86_64-linux~1.9.1/position.baseA
136
- - spec/fixtures/film_data/x86_64-linux~1.9.1/position.baseB
137
- - spec/fixtures/film_data/x86_64-linux~1.9.1/position.DB
138
- - spec/fixtures/film_data/x86_64-linux~1.9.1/postlist.baseA
139
- - spec/fixtures/film_data/x86_64-linux~1.9.1/postlist.baseB
140
- - spec/fixtures/film_data/x86_64-linux~1.9.1/postlist.DB
141
- - spec/fixtures/film_data/x86_64-linux~1.9.1/record.baseA
142
- - spec/fixtures/film_data/x86_64-linux~1.9.1/record.baseB
143
- - spec/fixtures/film_data/x86_64-linux~1.9.1/record.DB
144
- - spec/fixtures/film_data/x86_64-linux~1.9.1/termlist.baseA
145
- - spec/fixtures/film_data/x86_64-linux~1.9.1/termlist.baseB
146
- - spec/fixtures/film_data/x86_64-linux~1.9.1/termlist.DB
147
- - spec/fixtures/film_data/x86_64-linux~1.9.1/value.baseA
148
- - spec/fixtures/film_data/x86_64-linux~1.9.1/value.baseB
149
- - spec/fixtures/film_data/x86_64-linux~1.9.1/value.DB
150
- - spec/fixtures/film_data.rb
135
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/flintlock
136
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/iamchert
137
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/position.DB
138
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/position.baseA
139
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/position.baseB
140
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/postlist.DB
141
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/postlist.baseA
142
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/postlist.baseB
143
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/record.DB
144
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/record.baseA
145
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/record.baseB
146
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/spelling.DB
147
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/spelling.baseA
148
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/spelling.baseB
149
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/termlist.DB
150
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/termlist.baseA
151
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/termlist.baseB
151
152
  - spec/query_parser_spec.rb
152
153
  - spec/stopper_factory_spec.rb
153
154
  - spec/xapian_db_spec.rb
154
155
  - spec/xapian_doc_spec.rb
155
156
  - spec/xapian_doc_value_accessor_spec.rb
156
- homepage: http://github.com/johnl/xapian-fu
157
- licenses: []
157
+ homepage: https://github.com/johnl/xapian-fu
158
+ licenses:
159
+ - MIT
158
160
  metadata: {}
159
161
  post_install_message:
160
162
  rdoc_options:
161
- - --title
163
+ - "--title"
162
164
  - Xapian Fu
163
- - --main
165
+ - "--main"
164
166
  - README.rdoc
165
- - --line-numbers
167
+ - "--line-numbers"
166
168
  require_paths:
167
169
  - lib
168
170
  required_ruby_version: !ruby/object:Gem::Requirement
169
171
  requirements:
170
- - - ! '>='
172
+ - - ">="
171
173
  - !ruby/object:Gem::Version
172
- version: '0'
174
+ version: 1.9.3
173
175
  required_rubygems_version: !ruby/object:Gem::Requirement
174
176
  requirements:
175
- - - ! '>='
177
+ - - ">="
176
178
  - !ruby/object:Gem::Version
177
179
  version: '0'
178
- requirements: []
179
- rubyforge_project: xapian-fu
180
- rubygems_version: 2.0.0
180
+ requirements:
181
+ - libxapian-dev, or the xapian-ruby gem
182
+ rubyforge_project:
183
+ rubygems_version: 2.7.6.2
181
184
  signing_key:
182
185
  specification_version: 4
183
186
  summary: A Ruby interface to the Xapian search engine
184
187
  test_files:
185
- - spec/build_db_for_value_testing.rb
186
- - spec/facets_spec.rb
187
- - spec/fixtures/film_data/i486-linux~1.8.7/flintlock
188
- - spec/fixtures/film_data/i486-linux~1.8.7/iamflint
189
- - spec/fixtures/film_data/i486-linux~1.8.7/position.baseA
190
- - spec/fixtures/film_data/i486-linux~1.8.7/position.baseB
191
- - spec/fixtures/film_data/i486-linux~1.8.7/position.DB
192
- - spec/fixtures/film_data/i486-linux~1.8.7/postlist.baseA
193
- - spec/fixtures/film_data/i486-linux~1.8.7/postlist.baseB
194
- - spec/fixtures/film_data/i486-linux~1.8.7/postlist.DB
195
- - spec/fixtures/film_data/i486-linux~1.8.7/record.baseA
196
- - spec/fixtures/film_data/i486-linux~1.8.7/record.baseB
197
- - spec/fixtures/film_data/i486-linux~1.8.7/record.DB
198
- - spec/fixtures/film_data/i486-linux~1.8.7/termlist.baseA
199
- - spec/fixtures/film_data/i486-linux~1.8.7/termlist.baseB
200
- - spec/fixtures/film_data/i486-linux~1.8.7/termlist.DB
201
- - spec/fixtures/film_data/i486-linux~1.8.7/value.baseA
202
- - spec/fixtures/film_data/i486-linux~1.8.7/value.baseB
203
- - spec/fixtures/film_data/i486-linux~1.8.7/value.DB
204
- - spec/fixtures/film_data/x86_64-linux~1.8.7/flintlock
205
- - spec/fixtures/film_data/x86_64-linux~1.8.7/iamflint
188
+ - spec/xapian_db_spec.rb
189
+ - spec/fixtures/film_data.rb
190
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/position.baseA
191
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/flintlock
192
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/spelling.baseB
193
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/record.baseB
194
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/postlist.baseB
195
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/spelling.baseA
196
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/position.DB
197
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/postlist.baseA
198
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/iamchert
199
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/postlist.DB
200
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/position.baseB
201
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/termlist.DB
202
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/termlist.baseB
203
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/spelling.DB
204
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/record.DB
205
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/record.baseA
206
+ - spec/fixtures/film_data/x86_64-linux-gnu~2.5.5/termlist.baseA
207
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/position.baseA
208
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/flintlock
209
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/spelling.baseB
210
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/record.baseB
211
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/postlist.baseB
212
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/spelling.baseA
213
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/position.DB
214
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/postlist.baseA
215
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/iamchert
216
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/postlist.DB
217
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/position.baseB
218
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/termlist.DB
219
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/termlist.baseB
220
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/spelling.DB
221
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/record.DB
222
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/record.baseA
223
+ - spec/fixtures/film_data/x86_64-linux~1.9.3/termlist.baseA
206
224
  - spec/fixtures/film_data/x86_64-linux~1.8.7/position.baseA
207
- - spec/fixtures/film_data/x86_64-linux~1.8.7/position.baseB
225
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/flintlock
226
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/spelling.baseB
227
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/record.baseB
228
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/postlist.baseB
229
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/spelling.baseA
208
230
  - spec/fixtures/film_data/x86_64-linux~1.8.7/position.DB
209
231
  - spec/fixtures/film_data/x86_64-linux~1.8.7/postlist.baseA
210
- - spec/fixtures/film_data/x86_64-linux~1.8.7/postlist.baseB
232
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/iamchert
211
233
  - spec/fixtures/film_data/x86_64-linux~1.8.7/postlist.DB
212
- - spec/fixtures/film_data/x86_64-linux~1.8.7/record.baseA
213
- - spec/fixtures/film_data/x86_64-linux~1.8.7/record.baseB
234
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/position.baseB
235
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.DB
236
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.baseB
237
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/spelling.DB
214
238
  - spec/fixtures/film_data/x86_64-linux~1.8.7/record.DB
239
+ - spec/fixtures/film_data/x86_64-linux~1.8.7/record.baseA
215
240
  - spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.baseA
216
- - spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.baseB
217
- - spec/fixtures/film_data/x86_64-linux~1.8.7/termlist.DB
218
- - spec/fixtures/film_data/x86_64-linux~1.8.7/value.baseA
219
- - spec/fixtures/film_data/x86_64-linux~1.8.7/value.baseB
220
- - spec/fixtures/film_data/x86_64-linux~1.8.7/value.DB
221
- - spec/fixtures/film_data/x86_64-linux~1.9.1/flintlock
222
- - spec/fixtures/film_data/x86_64-linux~1.9.1/iamflint
223
- - spec/fixtures/film_data/x86_64-linux~1.9.1/position.baseA
224
- - spec/fixtures/film_data/x86_64-linux~1.9.1/position.baseB
225
- - spec/fixtures/film_data/x86_64-linux~1.9.1/position.DB
226
- - spec/fixtures/film_data/x86_64-linux~1.9.1/postlist.baseA
227
- - spec/fixtures/film_data/x86_64-linux~1.9.1/postlist.baseB
228
- - spec/fixtures/film_data/x86_64-linux~1.9.1/postlist.DB
229
- - spec/fixtures/film_data/x86_64-linux~1.9.1/record.baseA
230
- - spec/fixtures/film_data/x86_64-linux~1.9.1/record.baseB
231
- - spec/fixtures/film_data/x86_64-linux~1.9.1/record.DB
232
- - spec/fixtures/film_data/x86_64-linux~1.9.1/termlist.baseA
233
- - spec/fixtures/film_data/x86_64-linux~1.9.1/termlist.baseB
234
- - spec/fixtures/film_data/x86_64-linux~1.9.1/termlist.DB
235
- - spec/fixtures/film_data/x86_64-linux~1.9.1/value.baseA
236
- - spec/fixtures/film_data/x86_64-linux~1.9.1/value.baseB
237
- - spec/fixtures/film_data/x86_64-linux~1.9.1/value.DB
238
- - spec/fixtures/film_data.rb
239
241
  - spec/query_parser_spec.rb
240
242
  - spec/stopper_factory_spec.rb
241
- - spec/xapian_db_spec.rb
242
243
  - spec/xapian_doc_spec.rb
243
244
  - spec/xapian_doc_value_accessor_spec.rb
245
+ - spec/build_db_for_value_testing.rb
246
+ - spec/facets_spec.rb
@@ -1,47 +0,0 @@
1
- # A generic <tt>Xapian::PostingSource</tt>.
2
- class XapianFu::PostingSource < Xapian::PostingSource
3
- def init(db)
4
- @all = {}
5
- @ids = db.postlist("").map(&:docid)
6
-
7
- @ids.each do |id|
8
- @all[id] = db.document(id)
9
- end
10
-
11
- @iter = @ids.each
12
- @current = @iter.next
13
- @db = db
14
- end
15
-
16
- def next(minweight)
17
- @current = @iter.next
18
- rescue StopIteration
19
- @current = nil
20
- end
21
-
22
- def at_end
23
- @current.nil?
24
- end
25
-
26
- def docid
27
- @current
28
- end
29
-
30
- def get_termfreq_min
31
- 0
32
- end
33
-
34
- def get_termfreq_max
35
- @db.doccount
36
- end
37
-
38
- def get_termfreq_est
39
- @db.doccount
40
- end
41
-
42
- def get_maxweight
43
- 1
44
- end
45
- end
46
-
47
-