1 MODULE = Search::Xapian		PACKAGE = Search::Xapian::WritableDatabase
2 
3 PROTOTYPES: ENABLE
4 
5 WritableDatabase *
new1(file,opts)6 new1(file, opts)
7     string	file
8     int		opts
9     CODE:
10 	try {
11 	    RETVAL = new WritableDatabase(file, opts);
12 	} catch (...) {
13 	    handle_exception();
14 	}
15     OUTPUT:
16 	RETVAL
17 
18 WritableDatabase *
19 new2(database)
20     WritableDatabase *	database
21     CODE:
22 	RETVAL = new WritableDatabase(*database);
23     OUTPUT:
24 	RETVAL
25 
26 WritableDatabase *
new3()27 new3()
28     CODE:
29 	try {
30 #if XAPIAN_AT_LEAST(1,5,0)
31 	    RETVAL = new WritableDatabase(std::string(), Xapian::DB_BACKEND_INMEMORY);
32 #else
33 	    RETVAL = new WritableDatabase(InMemory::open());
34 #endif
35 	} catch (...) {
36 	    handle_exception();
37 	}
38     OUTPUT:
39 	RETVAL
40 
41 void
flush()42 WritableDatabase::flush()
43    CODE:
44 	try {
45 	    THIS->commit();
46 	} catch (...) {
47 	    handle_exception();
48 	}
49 
50 void
commit()51 WritableDatabase::commit()
52    CODE:
53 	try {
54 	    THIS->commit();
55 	} catch (...) {
56 	    handle_exception();
57 	}
58 
59 void
60 WritableDatabase::begin_transaction(flushed = NO_INIT)
61     bool flushed
62     CODE:
63 	try {
64 	    if (items == 2) { /* items includes the hidden this pointer */
65 		THIS->begin_transaction(flushed);
66 	    } else {
67 		THIS->begin_transaction();
68 	    }
catch(...)69 	} catch (...) {
70 	    handle_exception();
71 	}
72 
73 void
commit_transaction()74 WritableDatabase::commit_transaction()
75     CODE:
76 	try {
77 	    THIS->commit_transaction();
78 	} catch (...) {
79 	    handle_exception();
80 	}
81 
82 void
cancel_transaction()83 WritableDatabase::cancel_transaction()
84     CODE:
85 	try {
86 	    THIS->cancel_transaction();
87 	} catch (...) {
88 	    handle_exception();
89 	}
90 
91 docid
add_document(document)92 WritableDatabase::add_document(document)
93     Document *	document
94     CODE:
95 	try {
96 	    RETVAL = THIS->add_document(*document);
97 	} catch (...) {
98 	    handle_exception();
99 	}
100     OUTPUT:
101 	RETVAL
102 
103 void
delete_document(did)104 WritableDatabase::delete_document(did)
105     docid	did
106     CODE:
107 	try {
108 	    THIS->delete_document(did);
109 	} catch (...) {
110 	    handle_exception();
111 	}
112 
113 void
delete_document_by_term(unique_term)114 WritableDatabase::delete_document_by_term(unique_term)
115     string	unique_term
116     CODE:
117 	try {
118 	    THIS->delete_document(unique_term);
119 	} catch (...) {
120 	    handle_exception();
121 	}
122 
123 void
replace_document(did,document)124 WritableDatabase::replace_document(did, document)
125     docid	did
126     Document *	document
127     CODE:
128 	try {
129 	    THIS->replace_document(did, *document);
130 	} catch (...) {
131 	    handle_exception();
132 	}
133 
134 void
replace_document_by_term(unique_term,document)135 WritableDatabase::replace_document_by_term(unique_term, document)
136     string	unique_term
137     Document *	document
138     CODE:
139 	try {
140 	    THIS->replace_document(unique_term, *document);
141 	} catch (...) {
142 	    handle_exception();
143 	}
144 
145 void
set_metadata(string key,string value)146 WritableDatabase::set_metadata(string key, string value)
147     CODE:
148 	try {
149 	    THIS->set_metadata(key, value);
150 	} catch (...) {
151 	    handle_exception();
152 	}
153 
154 void
DESTROY()155 WritableDatabase::DESTROY()
156 
157 void
158 WritableDatabase::add_synonym(string term, string synonym)
159     CODE:
160 	try {
161 	    THIS->add_synonym(term, synonym);
162 	} catch (...) {
163 	    handle_exception();
164 	}
165 
166 void
remove_synonym(string term,string synonym)167 WritableDatabase::remove_synonym(string term, string synonym)
168     CODE:
169 	try {
170 	    THIS->remove_synonym(term, synonym);
171 	} catch (...) {
172 	    handle_exception();
173 	}
174 
175 void
clear_synonyms(string term)176 WritableDatabase::clear_synonyms(string term)
177     CODE:
178 	try {
179 	    THIS->clear_synonyms(term);
180 	} catch (...) {
181 	    handle_exception();
182 	}
183 
184 void
185 WritableDatabase::add_spelling(word, freqinc = 1)
186     string word
187     termcount freqinc
188     CODE:
189 	try {
190 	    THIS->add_spelling(word, freqinc);
catch(...)191 	} catch (...) {
192 	    handle_exception();
193 	}
194 
195 void
196 WritableDatabase::remove_spelling(word, freqdec  = 1)
197     string word
198     termcount freqdec
199     CODE:
200 	try {
201 	    THIS->remove_spelling(word, freqdec);
catch(...)202 	} catch (...) {
203 	    handle_exception();
204 	}
205