xapian 1.2.18.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. checksums.yaml +7 -0
  2. data/extconf.rb +6 -0
  3. data/util.i +220 -0
  4. data/xapian.rb +315 -0
  5. data/xapian_wrap.cc +32965 -0
  6. data/xapian_wrap.h +124 -0
  7. metadata +58 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7acb91c45544cbc3a54f65370ec29930ee81a56d
4
+ data.tar.gz: d9697fe51e58d3df43368b4a38abcd73842609fb
5
+ SHA512:
6
+ metadata.gz: 0e28d01dc98983d5968b336b01d1b28078dfbb5d42279fc08d797d16a3cff1d0478b8176f9fd54a9f38819287755d5ca923d47fe37bc4c57c3fdff99bcea8864
7
+ data.tar.gz: 648a35da910f7e9be2037f95e596cf628eba24d33a7feb32626bdbb6bbbd903cdfd04d62b81a1ecad7c2155091b8f72579f72dcc66458c6a5ab5fd9face29ba9
@@ -0,0 +1,6 @@
1
+ require "mkmf"
2
+
3
+ dir_config('xapian')
4
+ $libs = append_library($libs, with_config('xapianlib', 'xapian'))
5
+
6
+ create_makefile('_xapian')
data/util.i ADDED
@@ -0,0 +1,220 @@
1
+ %{
2
+ /* ruby/util.i: custom Ruby typemaps for xapian-bindings
3
+ *
4
+ * Original version by Paul Legato (plegato@nks.net), 4/17/06.
5
+ * Based on the php4 and python util.i files.
6
+ *
7
+ * Copyright (C) 2006 Networked Knowledge Systems, Inc.
8
+ * Copyright (C) 2006,2007,2008,2009,2010 Olly Betts
9
+ * Copyright (C) 2010 Richard Boulton
10
+ *
11
+ * This program is free software; you can redistribute it and/or
12
+ * modify it under the terms of the GNU General Public License as
13
+ * published by the Free Software Foundation; either version 2 of the
14
+ * License, or (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program; if not, write to the Free Software
23
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
24
+ * USA
25
+ *
26
+ */
27
+
28
+ %}
29
+
30
+ // Use SWIG directors for Ruby wrappers.
31
+ #define XAPIAN_SWIG_DIRECTORS
32
+
33
+ // We don't use the Iterator and ConstIterator wrappers which SWIG now offers,
34
+ // so disable them to reduce the generated C++ wrapper code.
35
+ #define SWIG_NO_EXPORT_ITERATOR_METHODS
36
+
37
+ /////////////////////////////////////
38
+ // Rename function and method names to match Ruby conventions
39
+ // e.g. from get_data to data and from set_data to data=
40
+
41
+ // Getters
42
+ %rename("available_languages") get_available_languages;
43
+ %rename("avlength") get_avlength;
44
+ %rename("collapse_count") get_collapse_count;
45
+ %rename("collection_freq") get_collection_freq;
46
+ %rename("context") get_context;
47
+ %rename("data") get_data;
48
+ %rename("default_op") get_default_op;
49
+ %rename("description") get_description;
50
+ %rename("docid") get_docid;
51
+ %rename("document_id") get_document_id;
52
+ %rename("document_percentage") get_document_percentage;
53
+ %rename("doccount") get_doccount;
54
+ %rename("doclength") get_doclength;
55
+ %rename("document") get_document;
56
+ %rename("ebound") get_ebound;
57
+ %rename("eset") get_eset;
58
+ %rename("firstitem") get_firstitem;
59
+ %rename("hit") get_hit;
60
+ %rename("lastdocid") get_lastdocid;
61
+ %rename("length") get_length;
62
+ %rename("matches_estimated") get_matches_estimated;
63
+ %rename("matches_lower_bound") get_matches_lower_bound;
64
+ %rename("matches_upper_bound") get_matches_upper_bound;
65
+ %rename("matching_terms") get_matching_terms;
66
+ %rename("max_attained") get_max_attained;
67
+ %rename("max_possible") get_max_possible;
68
+ %rename("maxextra") get_maxextra;
69
+ %rename("maxpart") get_maxpart;
70
+ %rename("mset") get_mset;
71
+ %rename("msg") get_msg;
72
+ %rename("op_name") get_op_name;
73
+ %rename("percent") get_percent;
74
+ %rename("query") get_query;
75
+ %rename("rank") get_rank;
76
+ %rename("sumextra") get_sumextra;
77
+ %rename("sumpart") get_sumpart;
78
+ %rename("termfreq") get_termfreq;
79
+ %rename("terms") get_terms;
80
+ %rename("term") get_term;
81
+ %rename("termpos") get_termpos;
82
+ %rename("termweight") get_termweight;
83
+ %rename("type") get_type;
84
+ %rename("value") get_value;
85
+ %rename("valueno") get_valueno;
86
+ %rename("wdf") get_wdf;
87
+ %rename("weight") get_weight;
88
+
89
+ // These are 'dangerous' methods; i.e. they can cause a segfault if used
90
+ // improperly. We prefix with _dangerous_ so that Ruby users will not use them
91
+ // inadvertently.
92
+ //
93
+ // There is a safe wrapper for their functionality provided in xapian.rb.
94
+
95
+ // in Xapian::Document and Xapian::Database
96
+ %rename("_dangerous_termlist_begin") termlist_begin;
97
+ %rename("_dangerous_termlist_end") termlist_end;
98
+ // in Xapian::Query
99
+ %rename("_dangerous_terms_begin") get_terms_begin;
100
+ %rename("_dangerous_terms_end") get_terms_end;
101
+ // in Xapian::Enquire
102
+ %rename("_dangerous_matching_terms_begin") get_matching_terms_begin;
103
+ %rename("_dangerous_matching_terms_end") get_matching_terms_end;
104
+ // in Xapian::Database
105
+ %rename("_dangerous_allterms_begin") allterms_begin;
106
+ %rename("_dangerous_allterms_end") allterms_end;
107
+ // in Xapian::Database
108
+ %rename("_dangerous_postlist_begin") postlist_begin;
109
+ %rename("_dangerous_postlist_end") postlist_end;
110
+ // in Xapian::Database
111
+ %rename("_dangerous_positionlist_begin") positionlist_begin;
112
+ %rename("_dangerous_positionlist_end") positionlist_end;
113
+ // in Xapian::Database
114
+ %rename("_dangerous_valuestream_begin") valuestream_begin;
115
+ %rename("_dangerous_valuestream_end") valuestream_end;
116
+ // in Xapian::Document and Xapian::ValueCountMatchSpy
117
+ %rename("_dangerous_values_begin") values_begin;
118
+ %rename("_dangerous_values_end") values_end;
119
+ // in Xapian::ValueCountMatchSpy
120
+ %rename("_dangerous_top_values_begin") top_values_begin;
121
+ %rename("_dangerous_top_values_end") top_values_end;
122
+
123
+
124
+ // MSetIterators are not dangerous, just inconvenient to use within a Ruby
125
+ // idiom.
126
+ %rename ("_begin") begin;
127
+ %rename ("_end") end;
128
+ %rename ("_back") back;
129
+
130
+
131
+
132
+ // Setters
133
+ %rename("collapse_key=") set_collapse_key;
134
+ %rename("cutoff!") set_cutoff;
135
+ %rename("data=") set_data;
136
+ %rename("database=") set_database;
137
+ %rename("default_op=") set_default_op;
138
+ %rename("docid_order=") set_docid_order;
139
+ %rename("document=") set_document;
140
+ %rename("query=") set_query(const Query &);
141
+ %rename("query!") set_query(const Query &, termcount qlen);
142
+ %rename("sort_by_relevance!") set_sort_by_relevance;
143
+ %rename("sort_by_relevance_then_value!") set_sort_by_relevance_then_value;
144
+ %rename("sort_by_value_then_relevance!") set_sort_by_value_then_relevance;
145
+ %rename("sort_by_value!") set_sort_by_value;
146
+ %rename("stemmer=") set_stemmer;
147
+ %rename("stemming_strategy=") set_stemming_strategy;
148
+ %rename("stopper=") set_stopper;
149
+ %rename("weighting_scheme=") set_weighting_scheme;
150
+
151
+ // Booleans
152
+ %predicate empty;
153
+
154
+ #define XAPIAN_MIXED_VECTOR_QUERY_INPUT_TYPEMAP
155
+ /*
156
+ * Check to see what is equivalent to a C++ Vector for the purposes of a Query
157
+ * instantiation.
158
+ * At the moment, we take Ruby Arrays.
159
+ */
160
+ %typemap(typecheck, precedence=500) const vector<Xapian::Query> & {
161
+ $1 = (TYPE($input) == T_ARRAY);
162
+
163
+ /* Says Olly:
164
+ * Currently, the only wrapped method which takes a Ruby array is the
165
+ * "extra" constructor Query(OP, ARRAY), where ARRAY can contain any mix of
166
+ * strings and Query objects.
167
+ *
168
+ * If we ever had a method (or function) which had two overloaded forms
169
+ * only differentiated by what type of array can be passed we'd need to
170
+ * look at the type of the array element in the typecheck typemaps.
171
+ */
172
+ }
173
+
174
+ /*
175
+ * Convert Ruby Arrays to C++ Vectors for Query instantiation.
176
+ */
177
+ %typemap(in) const vector<Xapian::Query> & (vector<Xapian::Query> v) {
178
+ if (TYPE($input) != T_ARRAY) {
179
+ SWIG_exception(SWIG_ValueError, "expected array of queries");
180
+ }
181
+
182
+ int numitems = RARRAY_LEN($input);
183
+ v.reserve(numitems);
184
+ for (int i = 0; i < numitems; ++i) {
185
+ VALUE arrayEntry = rb_ary_entry($input, i);
186
+ if (TYPE(arrayEntry) == T_STRING) {
187
+ v.push_back(Xapian::Query(string(RSTRING_PTR(arrayEntry),
188
+ RSTRING_LEN(arrayEntry))));
189
+ }
190
+ else {
191
+ // array element may be a Xapian::Query object. Add it if it is,
192
+ // otherwise error out.
193
+ Xapian::Query *subq = 0;
194
+ if (SWIG_ConvertPtr(arrayEntry, (void **)&subq,
195
+ SWIGTYPE_p_Xapian__Query, 0) < 0) {
196
+ subq = 0;
197
+ }
198
+ if (!subq) {
199
+ SWIG_exception(SWIG_ValueError, "elements of Arrays passed to Query must be either Strings or other Queries");
200
+ }
201
+ v.push_back(*subq);
202
+ }
203
+
204
+ }
205
+
206
+ $1 = &v;
207
+ }
208
+
209
+ %typemap(directorin) (size_t num_tags, const std::string tags[]) {
210
+ $input = rb_ary_new();
211
+ for (size_t i = 0; i != num_tags; ++i) {
212
+ VALUE str = rb_str_new(tags[i].data(), tags[i].size());
213
+ rb_ary_push($input, str);
214
+ }
215
+ }
216
+
217
+ // For MatchDecider::operator() and ExpandDecider::operator().
218
+ %typemap(directorout) int = bool;
219
+
220
+ /* vim:set syntax=cpp:set noexpandtab: */
@@ -0,0 +1,315 @@
1
+ # :title:Ruby Xapian bindings
2
+ # =Ruby Xapian bindings
3
+ #
4
+ # Original version by Paul Legato (plegato@nks.net), 4/20/06.
5
+ #
6
+ # Copyright (C) 2006 Networked Knowledge Systems, Inc.
7
+ # Copyright (C) 2008,2011 Olly Betts
8
+ # Copyright (C) 2010 Richard Boulton
9
+ #
10
+ # This program is free software; you can redistribute it and/or
11
+ # modify it under the terms of the GNU General Public License as
12
+ # published by the Free Software Foundation; either version 2 of the
13
+ # License, or (at your option) any later version.
14
+ #
15
+ # This program is distributed in the hope that it will be useful,
16
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ # GNU General Public License for more details.
19
+ #
20
+ # You should have received a copy of the GNU General Public License
21
+ # along with this program; if not, write to the Free Software
22
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23
+ # USA
24
+ #
25
+ # ==Underscore methods
26
+ # Note: Methods whose names start with an underscore character _ are internal
27
+ # methods from the C++ API. Their functionality is not accessible in a
28
+ # Ruby-friendly way, so this file provides wrapper code to make it easier to
29
+ # use them from a Ruby programming idiom. Most are also dangerous insofar as
30
+ # misusing them can cause your program to segfault. In particular, all of
31
+ # Xapian's *Iterator classes are wrapped into nice Ruby-friendly Arrays.
32
+ #
33
+ # It should never be necessary to use any method whose name starts with an
34
+ # underscore from user-level code. Make sure you are _VERY_ certain that you
35
+ # know exactly what you're doing if you do use one of these methods. Beware.
36
+ # You've been warned...
37
+ #
38
+
39
+
40
+ module Xapian
41
+ ######## load the SWIG-generated library
42
+ require '_xapian'
43
+
44
+
45
+ # iterate over two dangerous iterators (i.e. those that can cause segfaults
46
+ # if used improperly.)
47
+ # Return the results as an Array.
48
+ # Users should never need to use this method.
49
+ #
50
+ # Takes a block that returns some appropriate Ruby object to wrap the
51
+ # underlying Iterator
52
+ def _safelyIterate(dangerousStart, dangerousEnd) #:nodoc:
53
+ retval = Array.new
54
+
55
+ item = dangerousStart
56
+ lastTerm = dangerousEnd
57
+
58
+ return retval if dangerousStart.equals(dangerousEnd)
59
+
60
+ begin
61
+ retval.push(yield(item))
62
+ item.next()
63
+ end while not item.equals(lastTerm) # must use primitive C++ comparator
64
+
65
+ return retval
66
+ end # _safelyIterate
67
+ module_function :_safelyIterate
68
+
69
+ #--
70
+ ### safe Ruby wrapper for the dangerous C++ Xapian::TermIterator class
71
+ class Xapian::Term
72
+ attr_accessor :term, :wdf, :termfreq
73
+
74
+ def initialize(term, wdf=nil, termfreq=nil)
75
+ @term = term
76
+ @wdf = wdf
77
+ @termfreq = termfreq
78
+ end
79
+
80
+ def ==(other)
81
+ return other.is_a?(Xapian::Term) && other.term == @term && other.wdf == @wdf && other.termfreq == @termfreq
82
+ end
83
+ end # class Term
84
+
85
+ ### Ruby wrapper for a Match, i.e. a Xapian::MSetIterator (Match Set) in C++.
86
+ # it's no longer an iterator in the Ruby version, but we want to preserve its
87
+ # non-iterative data.
88
+ # (MSetIterator is not dangerous, but it is inconvenient to use from a Ruby
89
+ # idiom, so we wrap it..)
90
+ class Xapian::Match
91
+ attr_accessor :docid, :document, :rank, :weight, :collapse_count, :percent
92
+
93
+ def initialize(docid, document, rank, weight, collapse_count, percent)
94
+ @docid = docid
95
+ @document = document
96
+ @rank = rank
97
+ @weight = weight
98
+ @collapse_count = collapse_count
99
+ @percent = percent
100
+ end # initialize
101
+
102
+ def ==(other)
103
+ return other.is_a?(Xapian::Match) && other.docid == @docid && other.rank == @rank &&
104
+ other.weight == @weight && other.collapse_count == @collapse_count && other.percent == @percent
105
+ end
106
+ end # class Xapian::Match
107
+
108
+ # Ruby wrapper for an ExpandTerm, i.e. a Xapian::ESetIterator in C++
109
+ # Not dangerous, but inconvenient to use from a Ruby programming idiom, so we
110
+ # wrap it.
111
+ class Xapian::ExpandTerm
112
+ attr_accessor :name, :weight
113
+
114
+ def initialize(name, weight)
115
+ @name = name
116
+ @weight = weight
117
+ end # initialize
118
+
119
+ def ==(other)
120
+ return other.is_a?(Xapian::ExpandTerm) && other.name == @name && other.weight == @weight
121
+ end
122
+
123
+ end # Xapian::ExpandTerm
124
+
125
+ # Ruby wrapper for Xapian::ValueIterator
126
+ class Xapian::Value
127
+ attr_accessor :value, :valueno, :docid
128
+
129
+ def initialize(value, valueno, docid)
130
+ @value = value
131
+ @valueno = valueno
132
+ @docid = docid
133
+ end # initialize
134
+
135
+ def ==(other)
136
+ return other.is_a?(Xapian::Value) && other.value == @value && other.valueno == @valueno && other.docid == @docid
137
+ end
138
+ end # Xapian::Value
139
+
140
+ # Refer to the
141
+ # {Xapian::Document C++ API documentation}[http://xapian.org/docs/apidoc/html/classXapian_1_1Document.html]
142
+ # for methods not specific to Ruby.
143
+ #--
144
+ # Extend Xapian::Document with a nice wrapper for its nasty input_iterators
145
+ class Xapian::Document
146
+ def terms
147
+ Xapian._safelyIterate(self._dangerous_termlist_begin(), self._dangerous_termlist_end()) { |item|
148
+ Xapian::Term.new(item.term, item.wdf)
149
+ }
150
+ end # terms
151
+
152
+ def values
153
+ Xapian._safelyIterate(self._dangerous_values_begin(), self._dangerous_values_end()) { |item|
154
+ Xapian::Value.new(item.value, item.valueno, 0)
155
+ }
156
+ end # values
157
+
158
+ end # class Xapian::Document
159
+
160
+ # Refer to the
161
+ # {Xapian::Query C++ API documentation}[http://xapian.org/docs/apidoc/html/classXapian_1_1Query.html]
162
+ # for methods not specific to Ruby.
163
+ #--
164
+ # Extend Xapian::Query with a nice wrapper for its dangerous iterators
165
+ class Xapian::Query
166
+ def terms
167
+ Xapian._safelyIterate(self._dangerous_terms_begin(), self._dangerous_terms_end()) { |item|
168
+ Xapian::Term.new(item.term, item.wdf)
169
+ # termfreq is not supported by TermIterators from Queries
170
+ }
171
+ end # terms
172
+ end # Xapian::Query
173
+
174
+ # Refer to the
175
+ # {Xapian::Enquire C++ API documentation}[http://xapian.org/docs/apidoc/html/classXapian_1_1Enquire.html]
176
+ # for methods not specific to Ruby.
177
+ #--
178
+ # Extend Xapian::Enquire with a nice wrapper for its dangerous iterators
179
+ class Xapian::Enquire
180
+ # Get matching terms for some document.
181
+ # document can be either a Xapian::DocID or a Xapian::MSetIterator
182
+ def matching_terms(document)
183
+ Xapian._safelyIterate(self._dangerous_matching_terms_begin(document),
184
+ self._dangerous_matching_terms_end(document)) { |item|
185
+ Xapian::Term.new(item.term, item.wdf)
186
+ }
187
+ end # matching_terms
188
+ end # Xapian::Enquire
189
+
190
+ # Refer to the
191
+ # {Xapian::MSet C++ API documentation}[http://xapian.org/docs/apidoc/html/classXapian_1_1MSet.html]
192
+ # for methods not specific to Ruby.
193
+ #--
194
+ # MSetIterators are not dangerous, just inconvenient to use within a Ruby
195
+ # programming idiom. So we wrap them.
196
+ class Xapian::MSet
197
+ def matches
198
+ Xapian._safelyIterate(self._begin(),
199
+ self._end()) { |item|
200
+ Xapian::Match.new(item.docid, item.document, item.rank, item.weight, item.collapse_count, item.percent)
201
+ }
202
+
203
+ end # matches
204
+ end # Xapian::MSet
205
+
206
+ # Refer to the
207
+ # {Xapian::ESet C++ API documentation}[http://xapian.org/docs/apidoc/html/classXapian_1_1ESet.html]
208
+ # for methods not specific to Ruby.
209
+ #--
210
+ # ESetIterators are not dangerous, just inconvenient to use within a Ruby
211
+ # programming idiom. So we wrap them.
212
+ class Xapian::ESet
213
+ def terms
214
+ Xapian._safelyIterate(self._begin(),
215
+ self._end()) { |item|
216
+ # note: in the ExpandTerm wrapper, we implicitly rename
217
+ # ESetIterator#term() (defined in xapian.i) to ExpandTerm#term()
218
+ Xapian::ExpandTerm.new(item.term, item.weight)
219
+ }
220
+
221
+ end # terms
222
+ end # Xapian::ESet
223
+
224
+
225
+ #--
226
+ # Wrapper for the C++ class Xapian::PostingIterator
227
+ class Xapian::Posting
228
+ attr_accessor :docid, :doclength, :wdf
229
+
230
+ def initialize(docid, doclength, wdf)
231
+ @docid = docid
232
+ @doclength = doclength
233
+ @wdf = wdf
234
+ end
235
+
236
+ def ==(other)
237
+ return other.is_a?(Xapian::Posting) && other.docid == @docid && other.doclength == @doclength &&
238
+ other.wdf == @wdf
239
+ end
240
+ end # Xapian::Posting
241
+
242
+ # Refer to the
243
+ # {Xapian::Database C++ API documentation}[http://xapian.org/docs/apidoc/html/classXapian_1_1Database.html]
244
+ # for methods not specific to Ruby.
245
+ #--
246
+ # Wrap some dangerous iterators.
247
+ class Xapian::Database
248
+ # Returns an Array of all Xapian::Terms for this database.
249
+ def allterms(pref = '')
250
+ Xapian._safelyIterate(self._dangerous_allterms_begin(pref),
251
+ self._dangerous_allterms_end(pref)) { |item|
252
+ Xapian::Term.new(item.term, 0, item.termfreq)
253
+ }
254
+ end # allterms
255
+
256
+ # Returns an Array of Xapian::Postings for the given term.
257
+ # term is a string.
258
+ def postlist(term)
259
+ Xapian._safelyIterate(self._dangerous_postlist_begin(term),
260
+ self._dangerous_postlist_end(term)) { |item|
261
+ Xapian::Posting.new(item.docid, item.doclength, item.wdf)
262
+ }
263
+ end # postlist(term)
264
+
265
+ # Returns an Array of Terms for the given docid.
266
+ def termlist(docid)
267
+ Xapian._safelyIterate(self._dangerous_termlist_begin(docid),
268
+ self._dangerous_termlist_end(docid)) { |item|
269
+ Xapian::Term.new(item.term, item.wdf, item.termfreq)
270
+ }
271
+ end # termlist(docid)
272
+
273
+ # Returns an Array of Xapian::Termpos objects for the given term (a String)
274
+ # in the given docid.
275
+ def positionlist(docid, term)
276
+ Xapian._safelyIterate(self._dangerous_positionlist_begin(docid, term),
277
+ self._dangerous_positionlist_end(docid, term)) { |item|
278
+ item.termpos
279
+ }
280
+ end # positionlist
281
+
282
+ # Returns an Array of Xapian::Value objects for the given slot in the
283
+ # database.
284
+ def valuestream(slot)
285
+ Xapian._safelyIterate(self._dangerous_valuestream_begin(slot),
286
+ self._dangerous_valuestream_end(slot)) { |item|
287
+ Xapian::Value.new(item.value, slot, item.docid)
288
+ }
289
+ end # valuestream(slot)
290
+ end # Xapian::Database
291
+
292
+ # Refer to the
293
+ # {Xapian::ValueCountMatchSpy C++ API documentation}[http://xapian.org/docs/apidoc/html/classXapian_1_1ValueCountMatchSpy.html]
294
+ # for methods not specific to Ruby.
295
+ #--
296
+ # Wrap some dangerous iterators.
297
+ class Xapian::ValueCountMatchSpy
298
+ # Returns an Array of all the values seen, in alphabetical order
299
+ def values()
300
+ Xapian._safelyIterate(self._dangerous_values_begin(),
301
+ self._dangerous_values_end()) { |item|
302
+ Xapian::Term.new(item.term, 0, item.termfreq)
303
+ }
304
+ end # values
305
+
306
+ # Returns an Array of the top values seen, by frequency
307
+ def top_values(maxvalues)
308
+ Xapian._safelyIterate(self._dangerous_top_values_begin(maxvalues),
309
+ self._dangerous_top_values_end(maxvalues)) { |item|
310
+ Xapian::Term.new(item.term, 0, item.termfreq)
311
+ }
312
+ end # top_values
313
+ end # Xapian::Database
314
+
315
+ end # Xapian module