class Xapian::Xapian::Database - RDoc Documentation

# class Xapian::Xapian::Database

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

### Public Instance Methods

allterms(pref = '') click to toggle source

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

    # File xapian.rb, line 249
    def allterms(pref = '')
      Xapian._safelyIterate(self._dangerous_allterms_begin(pref),
                            self._dangerous_allterms_end(pref)) { |item|
        Xapian::Term.new(item.term, 0, item.termfreq)
      }
    end

positionlist(docid, term) click to toggle source

Returns an Array of Xapian::Termpos objects for the given term (a String) in the given docid.

    # File 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) click to toggle source

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

    # File 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) click to toggle source

Returns an Array of Terms for the given docid.

    # File 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) click to toggle source

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

    # File 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