1Xapian::WritableDatabasUes(e3r)Contributed Perl DocumentXaatpiioann::WritableDatabase(3)
2
3
4

NAME

6       Search::Xapian::WritableDatabase - writable database object
7

DESCRIPTION

9       This class represents a Xapian database for indexing. It's a subclass
10       of Search::Xapian::Database, which is used for searching.
11

METHODS

13       new <database> or new <path> <mode>
14           Class constructor. Takes either a database object, or a path and
15           one of DB_OPEN, DB_CREATE, DB_CREATE_OR_OPEN or
16           DB_CREATE_OR_OVERWRITE.  These are exported by Search::Xapian with
17           the 'db' option.
18
19       clone
20           Return a clone of this class.
21
22       flush
23           Flush to disk any modifications made to the database.
24
25           For efficiency reasons, when performing multiple updates to a
26           database it is best (indeed, almost essential) to make as many
27           modifications as memory will permit in a single pass through the
28           database. To ensure this, Xapian batches up modifications.
29
30           Flush may be called at any time to ensure that the modifications
31           which have been made are written to disk: if the flush succeeds,
32           all the preceding modifications will have been written to disk.
33
34           If any of the modifications fail, an exception will be thrown and
35           the database will be left in a state in which each separate
36           addition, replacement or deletion operation has either been fully
37           performed or not performed at all: it is then up to the application
38           to work out which operations need to be repeated.
39
40           Beware of calling flush too frequently: this will have a severe
41           performance cost.
42
43           Note that flush need not be called explicitly: it will be called
44           automatically when the database is closed, or when a sufficient
45           number of modifications have been made.
46
47       add_document <document>
48           Add a new document to the database.
49
50           This method adds the specified document to the database, returning
51           a newly allocated document ID.
52
53           Note that this does not mean the document will immediately appear
54           in the database; see flush() for more details.
55
56           As with all database modification operations, the effect is atomic:
57           the document will either be fully added, or the document fails to
58           be added and an exception is thrown (possibly at a later time when
59           flush is called or the database is closed).
60
61       delete_document <doc_id>
62           Delete a document from the database. This method removes the
63           document with the specified document ID from the database.
64
65           Note that this does not mean the document will immediately
66           disappear from the database; see flush() for more details.
67
68           As with all database modification operations, the effect is atomic:
69           the document will either be fully removed, or the document fails to
70           be removed and an exception is thrown (possibly at a later time
71           when flush is called or the database is closed).
72
73       delete_document_by_term <term>
74           Delete any documents indexed by a term from the database. This
75           method removes any documents indexed by the specified term from the
76           database.
77
78           The intended use is to allow UIDs from another system to easily be
79           mapped to terms in Xapian, although this method probably has other
80           uses.
81
82       replace_document <doc_id> <document>
83           eplace a given document in the database.
84
85           This method replaces the document with the specified document ID.
86           Note that this does not mean the document will immediately change
87           in the database; see flush() for more details.
88
89           As with all database modification operations, the effect is atomic:
90           the document will either be fully replaced, or the document fails
91           to be replaced and an exception is thrown (possibly at a later time
92           when flush is called or the database is closed).
93
94       replace_document_by_term <unique_term> <document>
95           Replace any documents matching an unique term.
96
97           This method replaces any documents indexed by the specified term
98           with the specified document. If any documents are indexed by the
99           term, the lowest document ID will be used for the document,
100           otherwise a new document ID will be generated as for add_document.
101
102           The intended use is to allow UIDs from another system to easily be
103           mapped to terms in Xapian, although this method probably has other
104           uses.
105
106           Note that this does not mean the document(s) will immediately
107           change in the database; see flush() for more details.
108
109           As with all database modification operations, the effect is atomic:
110           the document(s) will either be fully replaced, or the document(s)
111           fail to be replaced and an exception is thrown (possibly at a later
112           time when flush is called or the database is closed).
113
114       add_spelling <word> <freqinc>
115           Add a word to the spelling dictionary.
116
117           If the word is already present, its frequency is increased.
118
119           Parameters:
120               word     The word to add.
121               freqinc  How much to increase its frequency by (default 1).
122
123       remove_spelling <word> <freqdec>
124           Remove a word from the spelling dictionary.
125
126           The word's frequency is decreased, and if would become zero or less
127           then the word is removed completely.
128
129           Parameters:
130               word     The word to remove.
131               freqdec  How much to decrease its frequency by (default 1).
132
133       reopen
134           Re-open the database to ensure you are using the latest revision.
135
136       close
137           Close the database. This also implies a commit() unless a
138           transaction is in progress.
139

SEE ALSO

141       Search::Xapian, Search::Xapian::Enquire, Search::Xapian::Database
142
143
144
145perl v5.32.1                      2021-01-27       Xapian::WritableDatabase(3)
Impressum