Xapian::Database(3)

πŸ’– NAME πŸ’–

Search::Xapian::Database β€” the search database object, bestie. Around here it's also Xapian::Database(3), from the User Contributed Perl Documentation. Hi, welcome to the group chat ✨

✨ DESCRIPTION ✨

Okay so this class represents a Xapian database for searching. If you're trying to index stuff, go see Search::Xapian::WritableDatabase for an object suitable for indexing. To actually perform searches, this class works with the Search::Xapian::Query object. It's giving search-era main character energy, no cap πŸ’…

πŸŽ€ METHODS πŸŽ€

  • new <database> β€” class constructor, slay. It can take either a path to an existing database or another database class as the first parameter.
  • clone β€” returns a clone of this class. A little copy-paste moment, but make it official 🫢
  • add_database β€” add an existing database (or group of databases) to those accessed by this object. Group project, but make it databases.
  • 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. Refresh button energy, honestly.
  • close β€” close the database. Heads up: this also implies a commit() unless a transaction is in progress. So don't just ghost it, bestie 😭
  • enquire [<query>] β€” returns a new Search::Xapian::Enquire object. Any extra parameters are passed to set_query. Cute.
  • get_doccount β€” returns the number of documents indexed in this database. Count 'em πŸ‘‘
  • 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. Average is a vibe.
  • 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. A little true/false moment πŸ’€
  • get_description β€” return a description of this object.
  • get_spelling_suggestion β€” returns a suggested spelling correction. The autocorrect friend we all need πŸ™ˆ
  • allterms_begin [<prefix>] β€” returns a Search::Xapian::TermIterator iterating over the termlist for 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. Not me sending a lil ping so the remote DB doesn't ghost us 🌸
  • get_collection_freq <term> β€” get the number of elements indexed by a certain term.

πŸ‘€ SEE ALSO πŸ‘€

  • Search::Xapian
  • Search::Xapian::Enquire
  • Search::Xapian::WritableDatabase

Go read those too, bestie β€” it's the friend group πŸ’œ


mwah πŸ’‹ this iconic page is from perl v5.42.0, dated 2022-02-28, and it's Xapian::Database(3) β€” periodt.

πŸ“¦ where this page comes from