File: classXapian_1_1WritableDatabase.html

package info (click to toggle)
xapian-core 1.2.12-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 19,180 kB
  • sloc: cpp: 100,708; sh: 11,201; ansic: 8,177; makefile: 813; perl: 758; python: 40
file content (882 lines) | stat: -rw-r--r-- 62,859 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Xapian: API Documentation: xapian-core: Xapian::WritableDatabase Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff">
<!-- Generated by Doxygen 1.5.9 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.html"><span>Class&nbsp;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceXapian.html">Xapian</a>::<a class="el" href="classXapian_1_1WritableDatabase.html">WritableDatabase</a>
  </div>
</div>
<div class="contents">
<h1>Xapian::WritableDatabase Class Reference</h1><!-- doxytag: class="Xapian::WritableDatabase" --><!-- doxytag: inherits="Xapian::Database" -->This class provides read/write access to a database.  
<a href="#_details">More...</a>
<p>
<div class="dynheader">
Inheritance diagram for Xapian::WritableDatabase:</div>
<div class="dynsection">
<p><center><img src="classXapian_1_1WritableDatabase__inherit__graph.png" border="0" usemap="#Xapian_1_1WritableDatabase__inherit__map" alt="Inheritance graph"></center>
<map name="Xapian_1_1WritableDatabase__inherit__map">
<area shape="rect" href="classXapian_1_1Database.html" title="This class is used to access a database, or a group of databases." alt="" coords="31,7,164,33"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>

<p>
<a href="classXapian_1_1WritableDatabase-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#98ae55d72630237f346986b60e765e36">~WritableDatabase</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destroy this handle on the database.  <a href="#98ae55d72630237f346986b60e765e36"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c80ed31814feebd10c6222386e31472e"></a><!-- doxytag: member="Xapian::WritableDatabase::WritableDatabase" ref="c80ed31814feebd10c6222386e31472e" args="()" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#c80ed31814feebd10c6222386e31472e">WritableDatabase</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create an empty <a class="el" href="classXapian_1_1WritableDatabase.html" title="This class provides read/write access to a database.">WritableDatabase</a>. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#2084dc5811aedc7de65d77e7979a2ec8">WritableDatabase</a> (const std::string &amp;path, int action)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Open a database for update, automatically determining the database backend to use.  <a href="#2084dc5811aedc7de65d77e7979a2ec8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#1529742b3f7eb92f07e75f2308bc2f3a">WritableDatabase</a> (const <a class="el" href="classXapian_1_1WritableDatabase.html">WritableDatabase</a> &amp;other)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Copying is allowed.  <a href="#1529742b3f7eb92f07e75f2308bc2f3a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#c97254827cb74c93606ae046dcdd3754">operator=</a> (const <a class="el" href="classXapian_1_1WritableDatabase.html">WritableDatabase</a> &amp;other)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Assignment is allowed.  <a href="#c97254827cb74c93606ae046dcdd3754"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693">commit</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Commit any pending modifications made to the database.  <a href="#cbea2163142de795024880a7123bc693"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#e767fd6fec96a126763f818fdc0abca7">flush</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Pre-1.1.0 name for <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a>.  <a href="#e767fd6fec96a126763f818fdc0abca7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#1436584192e592cead34ea6a4d5af56f">begin_transaction</a> (bool flushed=true)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Begin a transaction.  <a href="#1436584192e592cead34ea6a4d5af56f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#3d330f3a27cc17d78635781c7b77280f">commit_transaction</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Complete the transaction currently in progress.  <a href="#3d330f3a27cc17d78635781c7b77280f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#537b50dd4aad61020ea8536e93559a72">cancel_transaction</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Abort the transaction currently in progress, discarding the pending modifications made to the database.  <a href="#537b50dd4aad61020ea8536e93559a72"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceXapian.html#8fa9094bebe1256a7be935a5ede87a64">Xapian::docid</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#ecdd2e1d3a0364c4933ef4fe655f080b">add_document</a> (const <a class="el" href="classXapian_1_1Document.html">Xapian::Document</a> &amp;document)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add a new document to the database.  <a href="#ecdd2e1d3a0364c4933ef4fe655f080b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#0cfd78ba9108b9ef2cf9b4a9f545c70d">delete_document</a> (<a class="el" href="namespaceXapian.html#8fa9094bebe1256a7be935a5ede87a64">Xapian::docid</a> did)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Delete a document from the database.  <a href="#0cfd78ba9108b9ef2cf9b4a9f545c70d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#8426619892e77112e832fc4b11b8efc3">delete_document</a> (const std::string &amp;unique_term)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Delete any documents indexed by a term from the database.  <a href="#8426619892e77112e832fc4b11b8efc3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#23344c9000ea98b15d491fa875bd5d1e">replace_document</a> (<a class="el" href="namespaceXapian.html#8fa9094bebe1256a7be935a5ede87a64">Xapian::docid</a> did, const <a class="el" href="classXapian_1_1Document.html">Xapian::Document</a> &amp;document)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Replace a given document in the database.  <a href="#23344c9000ea98b15d491fa875bd5d1e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceXapian.html#8fa9094bebe1256a7be935a5ede87a64">Xapian::docid</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#43c4630ec482508667e9ca539f19cbf0">replace_document</a> (const std::string &amp;unique_term, const <a class="el" href="classXapian_1_1Document.html">Xapian::Document</a> &amp;document)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Replace any documents matching a term.  <a href="#43c4630ec482508667e9ca539f19cbf0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#d80216c23c6b0175a0e235c4dccde390">add_spelling</a> (const std::string &amp;word, <a class="el" href="namespaceXapian.html#72b5a76dd8cfb7b251fe7986e86390cb">Xapian::termcount</a> freqinc=1) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add a word to the spelling dictionary.  <a href="#d80216c23c6b0175a0e235c4dccde390"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#1ef895fd7b1ed17bdb7036afc321cb3d">remove_spelling</a> (const std::string &amp;word, <a class="el" href="namespaceXapian.html#72b5a76dd8cfb7b251fe7986e86390cb">Xapian::termcount</a> freqdec=1) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Remove a word from the spelling dictionary.  <a href="#1ef895fd7b1ed17bdb7036afc321cb3d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#1b76ebd51f2c69898034d804de877ce6">add_synonym</a> (const std::string &amp;term, const std::string &amp;synonym) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Add a synonym for a term.  <a href="#1b76ebd51f2c69898034d804de877ce6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#0d29fb5845bcec5a8123334e654dc868">remove_synonym</a> (const std::string &amp;term, const std::string &amp;synonym) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Remove a synonym for a term.  <a href="#0d29fb5845bcec5a8123334e654dc868"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#2d0a6ca275afab052f675ac8a59dc2b4">clear_synonyms</a> (const std::string &amp;term) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Remove all synonyms for a term.  <a href="#2d0a6ca275afab052f675ac8a59dc2b4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#bd9a9fde5be5614e93559810df865a98">set_metadata</a> (const std::string &amp;key, const std::string &amp;value)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the user-specified metadata associated with a given key.  <a href="#bd9a9fde5be5614e93559810df865a98"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="714ee6f7f21fd72307329a4ba21227a0"></a><!-- doxytag: member="Xapian::WritableDatabase::get_description" ref="714ee6f7f21fd72307329a4ba21227a0" args="() const " -->
std::string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classXapian_1_1WritableDatabase.html#714ee6f7f21fd72307329a4ba21227a0">get_description</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Return a string describing this object. <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This class provides read/write access to a database. <hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="98ae55d72630237f346986b60e765e36"></a><!-- doxytag: member="Xapian::WritableDatabase::~WritableDatabase" ref="98ae55d72630237f346986b60e765e36" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual Xapian::WritableDatabase::~WritableDatabase           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Destroy this handle on the database. 
<p>
If no other handles to this database remain, the database will be closed.<p>
If a transaction is active <a class="el" href="classXapian_1_1WritableDatabase.html#537b50dd4aad61020ea8536e93559a72" title="Abort the transaction currently in progress, discarding the pending modifications...">cancel_transaction()</a> will be implicitly called; if no transaction is active <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> will be implicitly called, but any exception will be swallowed (because throwing exceptions in C++ destructors is problematic). If you aren't using transactions and want to know about any failure to commit changes, call <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> explicitly before the destructor gets called. 
</div>
</div><p>
<a class="anchor" name="2084dc5811aedc7de65d77e7979a2ec8"></a><!-- doxytag: member="Xapian::WritableDatabase::WritableDatabase" ref="2084dc5811aedc7de65d77e7979a2ec8" args="(const std::string &amp;path, int action)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Xapian::WritableDatabase::WritableDatabase           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>path</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>action</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Open a database for update, automatically determining the database backend to use. 
<p>
If the database is to be created, <a class="el" href="namespaceXapian.html" title="The Xapian namespace contains public interfaces for the Xapian library.">Xapian</a> will try to create the directory indicated by path if it doesn't already exist (but only the leaf directory, not recursively).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>path</em>&nbsp;</td><td>directory that the database is stored in. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>action</em>&nbsp;</td><td>one of:<ul>
<li><a class="el" href="namespaceXapian.html#3d32111900603ce02b8c8467b9c5bacb" title="Open for read/write; create if no db exists.">Xapian::DB_CREATE_OR_OPEN</a> open for read/write; create if no db exists</li><li><a class="el" href="namespaceXapian.html#1236aaa6a3d7a37a4c6b95439e449f7a" title="Create a new database; fail if db exists.">Xapian::DB_CREATE</a> create new database; fail if db exists</li><li><a class="el" href="namespaceXapian.html#fbc13e6712a12dcfd0c048242fc313ed" title="Overwrite existing db; create if none exists.">Xapian::DB_CREATE_OR_OVERWRITE</a> overwrite existing db; create if none exists</li><li><a class="el" href="namespaceXapian.html#54521467b649894bdc411f4c35e56ac3" title="Open for read/write; fail if no db exists.">Xapian::DB_OPEN</a> open for read/write; fail if no db exists</li></ul>
</td></tr>
  </table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseCorruptError.html" title="DatabaseCorruptError indicates database corruption was detected.">Xapian::DatabaseCorruptError</a></em>&nbsp;</td><td>will be thrown if the database is in a corrupt state.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseLockError.html" title="DatabaseLockError indicates failure to lock a database.">Xapian::DatabaseLockError</a></em>&nbsp;</td><td>will be thrown if a lock couldn't be acquired on the database. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="1529742b3f7eb92f07e75f2308bc2f3a"></a><!-- doxytag: member="Xapian::WritableDatabase::WritableDatabase" ref="1529742b3f7eb92f07e75f2308bc2f3a" args="(const WritableDatabase &amp;other)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Xapian::WritableDatabase::WritableDatabase           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classXapian_1_1WritableDatabase.html">WritableDatabase</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>other</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Copying is allowed. 
<p>
The internals are reference counted, so copying is cheap.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>other</em>&nbsp;</td><td>The object to copy. </td></tr>
  </table>
</dl>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="ecdd2e1d3a0364c4933ef4fe655f080b"></a><!-- doxytag: member="Xapian::WritableDatabase::add_document" ref="ecdd2e1d3a0364c4933ef4fe655f080b" args="(const Xapian::Document &amp;document)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespaceXapian.html#8fa9094bebe1256a7be935a5ede87a64">Xapian::docid</a> Xapian::WritableDatabase::add_document           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classXapian_1_1Document.html">Xapian::Document</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>document</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add a new document to the database. 
<p>
This method adds the specified document to the database, returning a newly allocated document ID. Automatically allocated document IDs come from a per-database monotonically increasing counter, so IDs from deleted documents won't be reused.<p>
If you want to specify the document ID to be used, you should call <a class="el" href="classXapian_1_1WritableDatabase.html#23344c9000ea98b15d491fa875bd5d1e" title="Replace a given document in the database.">replace_document()</a> instead.<p>
Note that changes to the database won't be immediately committed to disk; see <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> for more details.<p>
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 <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> is called or the database is closed).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>document</em>&nbsp;</td><td>The new document to be added.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The document ID of the newly added document.</dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseError.html" title="DatabaseError indicates some sort of database related error.">Xapian::DatabaseError</a></em>&nbsp;</td><td>will be thrown if a problem occurs while writing to the database.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseCorruptError.html" title="DatabaseCorruptError indicates database corruption was detected.">Xapian::DatabaseCorruptError</a></em>&nbsp;</td><td>will be thrown if the database is in a corrupt state. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="d80216c23c6b0175a0e235c4dccde390"></a><!-- doxytag: member="Xapian::WritableDatabase::add_spelling" ref="d80216c23c6b0175a0e235c4dccde390" args="(const std::string &amp;word, Xapian::termcount freqinc=1) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::add_spelling           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>word</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceXapian.html#72b5a76dd8cfb7b251fe7986e86390cb">Xapian::termcount</a>&nbsp;</td>
          <td class="paramname"> <em>freqinc</em> = <code>1</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add a word to the spelling dictionary. 
<p>
If the word is already present, its frequency is increased.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>word</em>&nbsp;</td><td>The word to add. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>freqinc</em>&nbsp;</td><td>How much to increase its frequency by (default 1). </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="1b76ebd51f2c69898034d804de877ce6"></a><!-- doxytag: member="Xapian::WritableDatabase::add_synonym" ref="1b76ebd51f2c69898034d804de877ce6" args="(const std::string &amp;term, const std::string &amp;synonym) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::add_synonym           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>term</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>synonym</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Add a synonym for a term. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>term</em>&nbsp;</td><td>The term to add a synonym for. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>synonym</em>&nbsp;</td><td>The synonym to add. If this is already a synonym for <em>term</em>, then no action is taken. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="1436584192e592cead34ea6a4d5af56f"></a><!-- doxytag: member="Xapian::WritableDatabase::begin_transaction" ref="1436584192e592cead34ea6a4d5af56f" args="(bool flushed=true)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::begin_transaction           </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>flushed</em> = <code>true</code>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Begin a transaction. 
<p>
In <a class="el" href="namespaceXapian.html" title="The Xapian namespace contains public interfaces for the Xapian library.">Xapian</a> a transaction is a group of modifications to the database which are linked such that either all will be applied simultaneously or none will be applied at all. Even in the case of a power failure, this characteristic should be preserved (as long as the filesystem isn't corrupted, etc).<p>
A transaction is started with <a class="el" href="classXapian_1_1WritableDatabase.html#1436584192e592cead34ea6a4d5af56f" title="Begin a transaction.">begin_transaction()</a> and can either be committed by calling <a class="el" href="classXapian_1_1WritableDatabase.html#3d330f3a27cc17d78635781c7b77280f" title="Complete the transaction currently in progress.">commit_transaction()</a> or aborted by calling <a class="el" href="classXapian_1_1WritableDatabase.html#537b50dd4aad61020ea8536e93559a72" title="Abort the transaction currently in progress, discarding the pending modifications...">cancel_transaction()</a>.<p>
By default, a transaction implicitly calls <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> before and after so that the modifications stand and fall without affecting modifications before or after.<p>
The downside of these implicit calls to <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> is that small transactions can harm indexing performance in the same way that explicitly calling <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> frequently can.<p>
If you're applying atomic groups of changes and only wish to ensure that each group is either applied or not applied, then you can prevent the automatic <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> before and after the transaction by starting the transaction with begin_transaction(false). However, if cancel_transaction is called (or if commit_transaction isn't called before the <a class="el" href="classXapian_1_1WritableDatabase.html" title="This class provides read/write access to a database.">WritableDatabase</a> object is destroyed) then any changes which were pending before the transaction began will also be discarded.<p>
Transactions aren't currently supported by the <a class="el" href="namespaceXapian_1_1InMemory.html" title="Database factory functions for the inmemory backend.">InMemory</a> backend.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>flushed</em>&nbsp;</td><td>Is this a flushed transaction? By default transactions are "flushed", which means that committing a transaction will ensure those changes are permanently written to the database. By contrast, unflushed transactions only ensure that changes within the transaction are either all applied or all aren't.</td></tr>
  </table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1UnimplementedError.html" title="UnimplementedError indicates an attempt to use an unimplemented feature.">Xapian::UnimplementedError</a></em>&nbsp;</td><td>will be thrown if transactions are not available for this database type.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1InvalidOperationError.html" title="InvalidOperationError indicates the API was used in an invalid way.">Xapian::InvalidOperationError</a></em>&nbsp;</td><td>will be thrown if this is called at an invalid time, such as when a transaction is already in progress. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="537b50dd4aad61020ea8536e93559a72"></a><!-- doxytag: member="Xapian::WritableDatabase::cancel_transaction" ref="537b50dd4aad61020ea8536e93559a72" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::cancel_transaction           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Abort the transaction currently in progress, discarding the pending modifications made to the database. 
<p>
If an error occurs in this method, an exception will be thrown, but the transaction will be cancelled anyway.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseError.html" title="DatabaseError indicates some sort of database related error.">Xapian::DatabaseError</a></em>&nbsp;</td><td>will be thrown if a problem occurs while modifying the database.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseCorruptError.html" title="DatabaseCorruptError indicates database corruption was detected.">Xapian::DatabaseCorruptError</a></em>&nbsp;</td><td>will be thrown if the database is in a corrupt state.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1InvalidOperationError.html" title="InvalidOperationError indicates the API was used in an invalid way.">Xapian::InvalidOperationError</a></em>&nbsp;</td><td>will be thrown if a transaction is not currently in progress.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1UnimplementedError.html" title="UnimplementedError indicates an attempt to use an unimplemented feature.">Xapian::UnimplementedError</a></em>&nbsp;</td><td>will be thrown if transactions are not available for this database type. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="2d0a6ca275afab052f675ac8a59dc2b4"></a><!-- doxytag: member="Xapian::WritableDatabase::clear_synonyms" ref="2d0a6ca275afab052f675ac8a59dc2b4" args="(const std::string &amp;term) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::clear_synonyms           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>term</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Remove all synonyms for a term. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>term</em>&nbsp;</td><td>The term to remove all synonyms for. If the term has no synonyms, no action is taken. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="cbea2163142de795024880a7123bc693"></a><!-- doxytag: member="Xapian::WritableDatabase::commit" ref="cbea2163142de795024880a7123bc693" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::commit           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Commit any pending modifications made to the database. 
<p>
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, <a class="el" href="namespaceXapian.html" title="The Xapian namespace contains public interfaces for the Xapian library.">Xapian</a> batches up modifications.<p>
This method may be called at any time to commit any pending modifications to the database.<p>
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.<p>
It's not valid to call <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> within a transaction.<p>
Beware of calling <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> too frequently: this will make indexing take much longer.<p>
Note that <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> 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. By default, this is every 10000 documents added, deleted, or modified. This value is rather conservative, and if you have a machine with plenty of memory, you can improve indexing throughput dramatically by setting XAPIAN_FLUSH_THRESHOLD in the environment to a larger value.<p>
This method was new in <a class="el" href="namespaceXapian.html" title="The Xapian namespace contains public interfaces for the Xapian library.">Xapian</a> 1.1.0 - in earlier versions it was called <a class="el" href="classXapian_1_1WritableDatabase.html#e767fd6fec96a126763f818fdc0abca7" title="Pre-1.1.0 name for commit().">flush()</a>.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseError.html" title="DatabaseError indicates some sort of database related error.">Xapian::DatabaseError</a></em>&nbsp;</td><td>will be thrown if a problem occurs while modifying the database.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseCorruptError.html" title="DatabaseCorruptError indicates database corruption was detected.">Xapian::DatabaseCorruptError</a></em>&nbsp;</td><td>will be thrown if the database is in a corrupt state. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="3d330f3a27cc17d78635781c7b77280f"></a><!-- doxytag: member="Xapian::WritableDatabase::commit_transaction" ref="3d330f3a27cc17d78635781c7b77280f" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::commit_transaction           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Complete the transaction currently in progress. 
<p>
If this method completes successfully and this is a flushed transaction, all the database modifications made during the transaction will have been committed to the database.<p>
If an error occurs, an exception will be thrown, and none of the modifications made to the database during the transaction will have been applied to the database.<p>
In all cases the transaction will no longer be in progress.<p>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseError.html" title="DatabaseError indicates some sort of database related error.">Xapian::DatabaseError</a></em>&nbsp;</td><td>will be thrown if a problem occurs while modifying the database.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseCorruptError.html" title="DatabaseCorruptError indicates database corruption was detected.">Xapian::DatabaseCorruptError</a></em>&nbsp;</td><td>will be thrown if the database is in a corrupt state.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1InvalidOperationError.html" title="InvalidOperationError indicates the API was used in an invalid way.">Xapian::InvalidOperationError</a></em>&nbsp;</td><td>will be thrown if a transaction is not currently in progress.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1UnimplementedError.html" title="UnimplementedError indicates an attempt to use an unimplemented feature.">Xapian::UnimplementedError</a></em>&nbsp;</td><td>will be thrown if transactions are not available for this database type. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="8426619892e77112e832fc4b11b8efc3"></a><!-- doxytag: member="Xapian::WritableDatabase::delete_document" ref="8426619892e77112e832fc4b11b8efc3" args="(const std::string &amp;unique_term)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::delete_document           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>unique_term</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Delete any documents indexed by a term from the database. 
<p>
This method removes any documents indexed by the specified term from the database.<p>
A major use is for convenience when UIDs from another system are mapped to terms in <a class="el" href="namespaceXapian.html" title="The Xapian namespace contains public interfaces for the Xapian library.">Xapian</a>, although this method has other uses (for example, you could add a "deletion date" term to documents at index time and use this method to delete all documents due for deletion on a particular date).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>unique_term</em>&nbsp;</td><td>The term to remove references to.</td></tr>
  </table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseError.html" title="DatabaseError indicates some sort of database related error.">Xapian::DatabaseError</a></em>&nbsp;</td><td>will be thrown if a problem occurs while writing to the database.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseCorruptError.html" title="DatabaseCorruptError indicates database corruption was detected.">Xapian::DatabaseCorruptError</a></em>&nbsp;</td><td>will be thrown if the database is in a corrupt state. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="0cfd78ba9108b9ef2cf9b4a9f545c70d"></a><!-- doxytag: member="Xapian::WritableDatabase::delete_document" ref="0cfd78ba9108b9ef2cf9b4a9f545c70d" args="(Xapian::docid did)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::delete_document           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceXapian.html#8fa9094bebe1256a7be935a5ede87a64">Xapian::docid</a>&nbsp;</td>
          <td class="paramname"> <em>did</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Delete a document from the database. 
<p>
This method removes the document with the specified document ID from the database.<p>
Note that changes to the database won't be immediately committed to disk; see <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> for more details.<p>
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 <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> is called or the database is closed).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>did</em>&nbsp;</td><td>The document ID of the document to be removed.</td></tr>
  </table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseError.html" title="DatabaseError indicates some sort of database related error.">Xapian::DatabaseError</a></em>&nbsp;</td><td>will be thrown if a problem occurs while writing to the database.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseCorruptError.html" title="DatabaseCorruptError indicates database corruption was detected.">Xapian::DatabaseCorruptError</a></em>&nbsp;</td><td>will be thrown if the database is in a corrupt state. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="e767fd6fec96a126763f818fdc0abca7"></a><!-- doxytag: member="Xapian::WritableDatabase::flush" ref="e767fd6fec96a126763f818fdc0abca7" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::flush           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Pre-1.1.0 name for <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a>. 
<p>
Use <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> instead in new code. This alias may be deprecated in the future. 
</div>
</div><p>
<a class="anchor" name="c97254827cb74c93606ae046dcdd3754"></a><!-- doxytag: member="Xapian::WritableDatabase::operator=" ref="c97254827cb74c93606ae046dcdd3754" args="(const WritableDatabase &amp;other)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::operator=           </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classXapian_1_1WritableDatabase.html">WritableDatabase</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>other</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Assignment is allowed. 
<p>
The internals are reference counted, so assignment is cheap.<p>
Note that only an <a class="el" href="classXapian_1_1WritableDatabase.html" title="This class provides read/write access to a database.">WritableDatabase</a> may be assigned to an <a class="el" href="classXapian_1_1WritableDatabase.html" title="This class provides read/write access to a database.">WritableDatabase</a>: an attempt to assign a <a class="el" href="classXapian_1_1Database.html" title="This class is used to access a database, or a group of databases.">Database</a> is caught at compile-time.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>other</em>&nbsp;</td><td>The object to copy. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="1ef895fd7b1ed17bdb7036afc321cb3d"></a><!-- doxytag: member="Xapian::WritableDatabase::remove_spelling" ref="1ef895fd7b1ed17bdb7036afc321cb3d" args="(const std::string &amp;word, Xapian::termcount freqdec=1) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::remove_spelling           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>word</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceXapian.html#72b5a76dd8cfb7b251fe7986e86390cb">Xapian::termcount</a>&nbsp;</td>
          <td class="paramname"> <em>freqdec</em> = <code>1</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Remove a word from the spelling dictionary. 
<p>
The word's frequency is decreased, and if would become zero or less then the word is removed completely.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>word</em>&nbsp;</td><td>The word to remove. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>freqdec</em>&nbsp;</td><td>How much to decrease its frequency by (default 1). </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="0d29fb5845bcec5a8123334e654dc868"></a><!-- doxytag: member="Xapian::WritableDatabase::remove_synonym" ref="0d29fb5845bcec5a8123334e654dc868" args="(const std::string &amp;term, const std::string &amp;synonym) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::remove_synonym           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>term</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>synonym</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Remove a synonym for a term. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>term</em>&nbsp;</td><td>The term to remove a synonym for. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>synonym</em>&nbsp;</td><td>The synonym to remove. If this isn't currently a synonym for <em>term</em>, then no action is taken. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="43c4630ec482508667e9ca539f19cbf0"></a><!-- doxytag: member="Xapian::WritableDatabase::replace_document" ref="43c4630ec482508667e9ca539f19cbf0" args="(const std::string &amp;unique_term, const Xapian::Document &amp;document)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="namespaceXapian.html#8fa9094bebe1256a7be935a5ede87a64">Xapian::docid</a> Xapian::WritableDatabase::replace_document           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>unique_term</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classXapian_1_1Document.html">Xapian::Document</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>document</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Replace any documents matching a term. 
<p>
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 ID will be used for the document, otherwise a new document ID will be generated as for add_document.<p>
One common use is to allow UIDs from another system to easily be mapped to terms in <a class="el" href="namespaceXapian.html" title="The Xapian namespace contains public interfaces for the Xapian library.">Xapian</a>. Note that this method doesn't automatically add unique_term as a term, so you'll need to call document.add_term(unique_term) first when using <a class="el" href="classXapian_1_1WritableDatabase.html#23344c9000ea98b15d491fa875bd5d1e" title="Replace a given document in the database.">replace_document()</a> in this way.<p>
Note that changes to the database won't be immediately committed to disk; see <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> for more details.<p>
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 <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> is called or the database is closed).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>unique_term</em>&nbsp;</td><td>The "unique" term. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>document</em>&nbsp;</td><td>The new document.</td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The document ID that document was given.</dd></dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseError.html" title="DatabaseError indicates some sort of database related error.">Xapian::DatabaseError</a></em>&nbsp;</td><td>will be thrown if a problem occurs while writing to the database.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseCorruptError.html" title="DatabaseCorruptError indicates database corruption was detected.">Xapian::DatabaseCorruptError</a></em>&nbsp;</td><td>will be thrown if the database is in a corrupt state. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="23344c9000ea98b15d491fa875bd5d1e"></a><!-- doxytag: member="Xapian::WritableDatabase::replace_document" ref="23344c9000ea98b15d491fa875bd5d1e" args="(Xapian::docid did, const Xapian::Document &amp;document)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::replace_document           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceXapian.html#8fa9094bebe1256a7be935a5ede87a64">Xapian::docid</a>&nbsp;</td>
          <td class="paramname"> <em>did</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classXapian_1_1Document.html">Xapian::Document</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>document</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Replace a given document in the database. 
<p>
This method replaces the document with the specified document ID. If document ID <em>did</em> isn't currently used, the document will be added with document ID <em>did</em>.<p>
The monotonic counter used for automatically allocating document IDs is increased so that the next automatically allocated document ID will be did + 1. Be aware that if you use this method to specify a high document ID for a new document, and also use <a class="el" href="classXapian_1_1WritableDatabase.html#ecdd2e1d3a0364c4933ef4fe655f080b" title="Add a new document to the database.">WritableDatabase::add_document()</a>, <a class="el" href="namespaceXapian.html" title="The Xapian namespace contains public interfaces for the Xapian library.">Xapian</a> may get to a state where this counter wraps around and will be unable to automatically allocate document IDs!<p>
Note that changes to the database won't be immediately committed to disk; see <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> for more details.<p>
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 <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> is called or the database is closed).<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>did</em>&nbsp;</td><td>The document ID of the document to be replaced. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>document</em>&nbsp;</td><td>The new document.</td></tr>
  </table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseError.html" title="DatabaseError indicates some sort of database related error.">Xapian::DatabaseError</a></em>&nbsp;</td><td>will be thrown if a problem occurs while writing to the database.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseCorruptError.html" title="DatabaseCorruptError indicates database corruption was detected.">Xapian::DatabaseCorruptError</a></em>&nbsp;</td><td>will be thrown if the database is in a corrupt state. </td></tr>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="bd9a9fde5be5614e93559810df865a98"></a><!-- doxytag: member="Xapian::WritableDatabase::set_metadata" ref="bd9a9fde5be5614e93559810df865a98" args="(const std::string &amp;key, const std::string &amp;value)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Xapian::WritableDatabase::set_metadata           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>value</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set the user-specified metadata associated with a given key. 
<p>
This method sets the metadata value associated with a given key. If there is already a metadata value stored in the database with the same key, the old value is replaced. If you want to delete an existing item of metadata, just set its value to the empty string.<p>
User-specified metadata allows you to store arbitrary information in the form of (key,tag) pairs.<p>
There's no hard limit on the number of metadata items, or the size of the metadata values. Metadata keys have a limited length, which depends on the backend. We recommend limiting them to 200 bytes. Empty keys are not valid, and specifying one will cause an exception.<p>
Metadata modifications are committed to disk in the same way as modifications to the documents in the database are: i.e., modifications are atomic, and won't be committed to disk immediately (see <a class="el" href="classXapian_1_1WritableDatabase.html#cbea2163142de795024880a7123bc693" title="Commit any pending modifications made to the database.">commit()</a> for more details). This allows metadata to be used to link databases with versioned external resources by storing the appropriate version number in a metadata item.<p>
You can also use the metadata to store arbitrary extra information associated with terms, documents, or postings by encoding the termname and/or document id into the metadata key.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>key</em>&nbsp;</td><td>The key of the metadata item to set.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em>value</em>&nbsp;</td><td>The value of the metadata item to set.</td></tr>
  </table>
</dl>
<dl compact><dt><b>Exceptions:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseError.html" title="DatabaseError indicates some sort of database related error.">Xapian::DatabaseError</a></em>&nbsp;</td><td>will be thrown if a problem occurs while writing to the database.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1DatabaseCorruptError.html" title="DatabaseCorruptError indicates database corruption was detected.">Xapian::DatabaseCorruptError</a></em>&nbsp;</td><td>will be thrown if the database is in a corrupt state.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1InvalidArgumentError.html" title="InvalidArgumentError indicates an invalid parameter value was passed to the API.">Xapian::InvalidArgumentError</a></em>&nbsp;</td><td>will be thrown if the key supplied is empty.</td></tr>
    <tr><td valign="top"></td><td valign="top"><em><a class="el" href="classXapian_1_1UnimplementedError.html" title="UnimplementedError indicates an attempt to use an unimplemented feature.">Xapian::UnimplementedError</a></em>&nbsp;</td><td>will be thrown if the database backend in use doesn't support user-specified metadata. </td></tr>
  </table>
</dl>

</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>xapian/<a class="el" href="database_8h.html">database.h</a></ul>
</div>
<hr>
<address><small>
Documentation for Xapian (version 1.2.12).<br>
Generated on 27 Jun 2012 by
<a href="http://www.doxygen.org/">Doxygen 1.5.9</a>.
</small></address>
</body>
</html>