.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Xapian::WritableDatabase 3pm" .TH Xapian::WritableDatabase 3pm "2012-05-09" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Search::Xapian::WritableDatabase \- writable database object .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class represents a Xapian database for indexing. It's a subclass of Search::Xapian::Database, which is used for searching. .SH "METHODS" .IX Header "METHODS" .IP "new or new " 4 .IX Item "new or new " Class constructor. Takes either a database object, or a path and one of \s-1DB_OPEN\s0, \s-1DB_CREATE\s0, \s-1DB_CREATE_OR_OPEN\s0 or \s-1DB_CREATE_OR_OVERWRITE\s0. These are exported by Search::Xapian with the 'db' option. .IP "clone" 4 .IX Item "clone" Return a clone of this class. .IP "flush" 4 .IX Item "flush" Flush to disk any modifications made to the database. .Sp For efficiency reasons, when performing multiple updates to a database it is best (indeed, almost essential) to make as many modifications as memory will permit in a single pass through the database. To ensure this, Xapian batches up modifications. .Sp Flush may be called at any time to ensure that the modifications which have been made are written to disk: if the flush succeeds, all the preceding modifications will have been written to disk. .Sp If any of the modifications fail, an exception will be thrown and the database will be left in a state in which each separate addition, replacement or deletion operation has either been fully performed or not performed at all: it is then up to the application to work out which operations need to be repeated. .Sp Beware of calling flush too frequently: this will have a severe performance cost. .Sp Note that flush need not be called explicitly: it will be called automatically when the database is closed, or when a sufficient number of modifications have been made. .IP "add_document " 4 .IX Item "add_document " Add a new document to the database. .Sp This method adds the specified document to the database, returning a newly allocated document \s-1ID\s0. .Sp Note that this does not mean the document will immediately appear in the database; see \fIflush()\fR for more details. .Sp As with all database modification operations, the effect is atomic: the document will either be fully added, or the document fails to be added and an exception is thrown (possibly at a later time when flush is called or the database is closed). .IP "delete_document " 4 .IX Item "delete_document " Delete a document from the database. This method removes the document with the specified document \s-1ID\s0 from the database. .Sp Note that this does not mean the document will immediately disappear from the database; see \fIflush()\fR for more details. .Sp As with all database modification operations, the effect is atomic: the document will either be fully removed, or the document fails to be removed and an exception is thrown (possibly at a later time when flush is called or the database is closed). .IP "delete_document_by_term " 4 .IX Item "delete_document_by_term " Delete any documents indexed by a term from the database. This method removes any documents indexed by the specified term from the database. .Sp The intended use is to allow UIDs from another system to easily be mapped to terms in Xapian, although this method probably has other uses. .IP "replace_document " 4 .IX Item "replace_document " eplace a given document in the database. .Sp This method replaces the document with the specified document \s-1ID\s0. Note that this does not mean the document will immediately change in the database; see \&\fIflush()\fR for more details. .Sp As with all database modification operations, the effect is atomic: the document will either be fully replaced, or the document fails to be replaced and an exception is thrown (possibly at a later time when flush is called or the database is closed). .IP "replace_document_by_term " 4 .IX Item "replace_document_by_term " Replace any documents matching an unique term. .Sp This method replaces any documents indexed by the specified term with the specified document. If any documents are indexed by the term, the lowest document \s-1ID\s0 will be used for the document, otherwise a new document \s-1ID\s0 will be generated as for add_document. .Sp The intended use is to allow UIDs from another system to easily be mapped to terms in Xapian, although this method probably has other uses. .Sp Note that this does not mean the document(s) will immediately change in the database; see \fIflush()\fR for more details. .Sp As with all database modification operations, the effect is atomic: the document(s) will either be fully replaced, or the document(s) fail to be replaced and an exception is thrown (possibly at a later time when flush is called or the database is closed). .IP "add_spelling " 4 .IX Item "add_spelling " Add a word to the spelling dictionary. .Sp If the word is already present, its frequency is increased. .Sp Parameters: word The word to add. freqinc How much to increase its frequency by (default 1). .IP "remove_spelling " 4 .IX Item "remove_spelling " Remove a word from the spelling dictionary. .Sp The word's frequency is decreased, and if would become zero or less then the word is removed completely. .Sp Parameters: word The word to remove. freqdec How much to decrease its frequency by (default 1). .IP "reopen" 4 .IX Item "reopen" Re-open the database to ensure you are using the latest revision. .IP "close" 4 .IX Item "close" Close the database. This also implies a \fIcommit()\fR unless a transaction is in progress. .SH "SEE ALSO" .IX Header "SEE ALSO" Search::Xapian,Search::Xapian::Enquire,Search::Xapian::Database