Class: Xapian::Database
- Inherits:
-
Object
- Object
- Xapian::Database
- Defined in:
- lib/xapian.rb
Overview
Refer to the Xapian::Database C++ API documentation for methods not specific to Ruby. – Wrap some dangerous iterators.
Instance Method Summary collapse
-
#allterms ⇒ Object
Returns an Array of all Xapian::Terms for this database.
-
#positionlist(docid, term) ⇒ Object
Returns an Array of Xapian::Termpos objects for the given term (a String) in the given docid.
-
#postlist(term) ⇒ Object
Returns an Array of Xapian::Postings for the given term.
-
#termlist(docid) ⇒ Object
Returns an Array of Terms for the given docid.
-
#valuestream(slot) ⇒ Object
Returns an Array of Xapian::Value objects for the given slot in the database.
Instance Method Details
#allterms ⇒ Object
Returns an Array of all Xapian::Terms for this database.
249 250 251 252 253 254 |
# File 'lib/xapian.rb', line 249 def allterms Xapian._safelyIterate(self._dangerous_allterms_begin(), self._dangerous_allterms_end()) { |item| Xapian::Term.new(item.term, 0, item.termfreq) } end |
#positionlist(docid, term) ⇒ Object
Returns an Array of Xapian::Termpos objects for the given term (a String) in the given docid.
275 276 277 278 279 280 |
# File 'lib/xapian.rb', line 275 def positionlist(docid, term) Xapian._safelyIterate(self._dangerous_positionlist_begin(docid, term), self._dangerous_positionlist_end(docid, term)) { |item| item.termpos } end |
#postlist(term) ⇒ Object
Returns an Array of Xapian::Postings for the given term. term is a string.
258 259 260 261 262 263 |
# File 'lib/xapian.rb', line 258 def postlist(term) Xapian._safelyIterate(self._dangerous_postlist_begin(term), self._dangerous_postlist_end(term)) { |item| Xapian::Posting.new(item.docid, item.doclength, item.wdf) } end |
#termlist(docid) ⇒ Object
Returns an Array of Terms for the given docid.
266 267 268 269 270 271 |
# File 'lib/xapian.rb', line 266 def termlist(docid) Xapian._safelyIterate(self._dangerous_termlist_begin(docid), self._dangerous_termlist_end(docid)) { |item| Xapian::Term.new(item.term, item.wdf, item.termfreq) } end |
#valuestream(slot) ⇒ Object
Returns an Array of Xapian::Value objects for the given slot in the database.
284 285 286 287 288 289 |
# File 'lib/xapian.rb', line 284 def valuestream(slot) Xapian._safelyIterate(self._dangerous_valuestream_begin(slot), self._dangerous_valuestream_end(slot)) { |item| Xapian::Value.new(item.value, slot, item.docid) } end |