class Xapian::Database

Refer to the Xapian::Database C++ API documentation for methods not specific to Ruby.

Public Instance Methods

allterms(pref = '', &block) click to toggle source

Returns an Array of all Xapian::Terms for this database.

# File xapian.rb, line 270
def allterms(pref = '', &block)
  Xapian._safelyIterate(self._dangerous_allterms_begin(pref),
                        self._dangerous_allterms_end(pref),
                        lambda { |item| Xapian::Term.new(item.term, 0, item.termfreq) },
                        &block)
end
metadata_keys(pref = '', &block) click to toggle source

Returns an Array of all metadata keys for this database.

# File xapian.rb, line 278
def metadata_keys(pref = '', &block)
  Xapian._safelyIterate(self._dangerous_metadata_keys_begin(pref),
                        self._dangerous_metadata_keys_end(pref),
                        lambda { |item| item.term },
                        &block)
end
positionlist(docid, term, &block) click to toggle source

Returns an Array of term positions for the given term (a String) in the given docid.

# File xapian.rb, line 304
def positionlist(docid, term, &block)
  Xapian._safelyIterate(self._dangerous_positionlist_begin(docid, term),
                        self._dangerous_positionlist_end(docid, term),
                        lambda { |item| item.termpos },
                        &block)
end
postlist(term, &block) click to toggle source

Returns an Array of Xapian::Postings for the given term. term is a string.

# File xapian.rb, line 287
def postlist(term, &block)
  Xapian._safelyIterate(self._dangerous_postlist_begin(term),
                        self._dangerous_postlist_end(term),
                        lambda { |item| Xapian::Posting.new(item.docid, item.doclength, item.wdf) },
                        &block)
end
spellings(&block) click to toggle source

Returns an Array of Xapian::Term objects for the spelling dictionary.

# File xapian.rb, line 321
def spellings(&block)
  Xapian._safelyIterate(self._dangerous_spellings_begin(),
                        self._dangerous_spellings_end(),
                        lambda { |item| Xapian::Term.new(item.term, 0, item.termfreq) },
                        &block)
end
synonym_keys(&block) click to toggle source

Returns an Array of terms with synonyms.

# File xapian.rb, line 337
def synonym_keys(&block)
  Xapian._safelyIterate(self._dangerous_synonym_keys_begin(),
                        self._dangerous_synonym_keys_end(),
                        lambda { |item| item.term },
                        &block)
end
synonyms(term, &block) click to toggle source

Returns an Array of synonyms of the given term.

# File xapian.rb, line 329
def synonyms(term, &block)
  Xapian._safelyIterate(self._dangerous_synonyms_begin(term),
                        self._dangerous_synonyms_end(term),
                        lambda { |item| item.term },
                        &block)
end
termlist(docid, &block) click to toggle source

Returns an Array of Terms for the given docid.

# File xapian.rb, line 295
def termlist(docid, &block)
  Xapian._safelyIterate(self._dangerous_termlist_begin(docid),
                        self._dangerous_termlist_end(docid),
                        lambda { |item| Xapian::Term.new(item.term, item.wdf, item.termfreq) },
                        &block)
end
valuestream(slot, &block) click to toggle source

Returns an Array of Xapian::Value objects for the given slot in the database.

# File xapian.rb, line 313
def valuestream(slot, &block)
  Xapian._safelyIterate(self._dangerous_valuestream_begin(slot),
                        self._dangerous_valuestream_end(slot),
                        lambda { |item| Xapian::Value.new(item.value, slot, item.docid) },
                        &block)
end