---
name: "Search::Xapian::Database"
section: "3pm"
platform: "linux"
package: "libsearch-xapian-perl"
version: "1.2.25.5-3+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Search::Xapian::Database"
---

# Search::Xapian::Database(3pm)

Search database object

## NAME

Search::Xapian::Database - Search database object

## DESCRIPTION

This class represents a Xapian database for searching. See Search::Xapian::WritableDatabase for an object suitable for indexing. To perform searches, this class works with the Search::Xapian::Query object.

## METHODS

- new \<database\>

  Class constructor. Can either take a path to an existing database or another database class as the first parameter

- clone

  Return a clone of this class.

- add\_database

  Add an existing database (or group of databases) to those accessed by this object.

- reopen

  This re-opens the database(s) to the latest available version(s). It can be used either to make sure the latest results are returned, or to recover from a Xapian::DatabaseModifiedError.

- close

  Close the database. This also implies a **commit()** unless a transaction is in progress.

- enquire \[\<query\>\]

  Returns a new Search::Xapian::Enquire object. Any extra parameters are passed to set\_query.

- get\_doccount

  Returns the number of document indexed in this database.

- get\_lastdocid

  Returns the id of the last used document.

- get\_doclength \<doc\_id\>

  Returns the length of a given document.

- get\_document \<doc\_id\>

  Returns a Search::Xapian::Document object for the given document.

- get\_avlength

  Get the average length of the documents in the database.

- get\_termfreq \<term\>

  Get the number of documents in the database indexed by a given term.

- term\_exists \<term\>

  returns true if this term exists in the database, or false otherwise.

- get\_description

  return a description of this object.

- get\_spelling\_suggestion

  returns a suggested spelling correction.

- allterms\_begin \[\<prefix\>\]

  Returns a Search::Xapian::TermIterator iterating over the termlist for the the entire database.  If the optional prefix argument is non-empty, only terms starting with that string are returned.

- allterms\_end \[\<prefix\>\]

  Returns a Search::Xapian::TermIterator pointing to the end of the termlist corresponding to allterms\_begin.

- termlist\_begin \<docid\>

  Returns a Search::Xapian::TermIterator pointing to the start of the termlist for a given document.

- termlist\_end \<docid\>

  Returns a Search::Xapian::TermIterator pointing to the end of the termlist for a given document.

- positionlist\_begin \<docid\> \<term\>

  Returns a Search::Xapian::PositionIterator pointing to the start of the position list for a given term in the given document.

- positionlist\_end \<docid\> \<term\>

  Returns a Search::Xapian::PositionIterator pointing to the end of the position list for a given term in the given document.

- postlist\_begin \<term\>

  Returns a Search::Xapian::PostingIterator pointing to the start of the posting list for a given term.

- postlist\_end \<term\>

  Returns a Search::Xapian::PostingIterator pointing to the end of the posting list for a given term.

- keep\_alive

  Send a "keep-alive" to remote databases to stop them timing out.

- get\_collection\_freq \<term\>

  Get the number of elements indexed by a certain term.

## SEE ALSO

Search::Xapian, Search::Xapian::Enquire, Search::Xapian::WritableDatabase
