Class: Xapian::Database
- Inherits:
-
Object
- Object
- Xapian::Database
- Defined in:
- lib/xapian.rb
Overview
– 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.
Instance Method Details
#allterms ⇒ Object
Returns an Array of all Xapian::Terms for this database.
228 229 230 231 232 233 |
# File 'lib/xapian.rb', line 228 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.
255 256 257 258 259 260 |
# File 'lib/xapian.rb', line 255 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.
237 238 239 240 241 242 |
# File 'lib/xapian.rb', line 237 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.
245 246 247 248 249 250 |
# File 'lib/xapian.rb', line 245 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 |