File: Database.cs

package info (click to toggle)
xapian-bindings 1.2.3-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 10,144 kB
  • ctags: 13,789
  • sloc: cpp: 139,078; sh: 10,401; python: 5,530; cs: 5,394; java: 5,243; php: 2,029; makefile: 783; ruby: 452; tcl: 250
file content (336 lines) | stat: -rw-r--r-- 13,903 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
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.40
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace Xapian {

using System;
using System.Runtime.InteropServices;

public class Database : IDisposable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

  internal Database(IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(Database obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~Database() {
    Dispose();
  }

  public virtual void Dispose() {
    lock(this) {
      if (swigCPtr.Handle != IntPtr.Zero) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          XapianPINVOKE.delete_Database(swigCPtr);
        }
        swigCPtr = new HandleRef(null, IntPtr.Zero);
      }
      GC.SuppressFinalize(this);
    }
  }

  public void AddDatabase(Database database) {
    XapianPINVOKE.Database_AddDatabase(swigCPtr, Database.getCPtr(database));
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public Database() : this(XapianPINVOKE.new_Database__SWIG_0(), true) {
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public Database(string path) : this(XapianPINVOKE.new_Database__SWIG_1(path), true) {
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public Database(Database other) : this(XapianPINVOKE.new_Database__SWIG_2(Database.getCPtr(other)), true) {
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void Reopen() {
    XapianPINVOKE.Database_Reopen(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void Close() {
    XapianPINVOKE.Database_Close(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public string GetDescription() {
    string ret = XapianPINVOKE.Database_GetDescription(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public PostingIterator PostListBegin(string tname) {
    PostingIterator ret = new PostingIterator(XapianPINVOKE.Database_PostListBegin(swigCPtr, tname), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public PostingIterator PostListEnd(string tname) {
    PostingIterator ret = new PostingIterator(XapianPINVOKE.Database_PostListEnd(swigCPtr, tname), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator TermListBegin(uint did) {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_TermListBegin(swigCPtr, did), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator TermListEnd(uint did) {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_TermListEnd(swigCPtr, did), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public PositionIterator PositionListBegin(uint did, string tname) {
    PositionIterator ret = new PositionIterator(XapianPINVOKE.Database_PositionListBegin(swigCPtr, did, tname), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public PositionIterator PositionListEnd(uint did, string tname) {
    PositionIterator ret = new PositionIterator(XapianPINVOKE.Database_PositionListEnd(swigCPtr, did, tname), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator AllTermsBegin() {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_AllTermsBegin__SWIG_0(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator AllTermsEnd() {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_AllTermsEnd__SWIG_0(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator AllTermsBegin(string prefix) {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_AllTermsBegin__SWIG_1(swigCPtr, prefix), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator AllTermsEnd(string prefix) {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_AllTermsEnd__SWIG_1(swigCPtr, prefix), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetDocCount() {
    uint ret = XapianPINVOKE.Database_GetDocCount(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetLastDocId() {
    uint ret = XapianPINVOKE.Database_GetLastDocId(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public double GetAvLength() {
    double ret = XapianPINVOKE.Database_GetAvLength(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetTermFreq(string tname) {
    uint ret = XapianPINVOKE.Database_GetTermFreq(swigCPtr, tname);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public bool TermExists(string tname) {
    bool ret = XapianPINVOKE.Database_TermExists(swigCPtr, tname);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetCollectionFreq(string tname) {
    uint ret = XapianPINVOKE.Database_GetCollectionFreq(swigCPtr, tname);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetValueFreq(uint valno) {
    uint ret = XapianPINVOKE.Database_GetValueFreq(swigCPtr, valno);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string GetValueLowerBound(uint valno) {
    string ret = XapianPINVOKE.Database_GetValueLowerBound(swigCPtr, valno);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string GetValueUpperBound(uint valno) {
    string ret = XapianPINVOKE.Database_GetValueUpperBound(swigCPtr, valno);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetDoclengthLowerBound() {
    uint ret = XapianPINVOKE.Database_GetDoclengthLowerBound(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetDoclengthUpperBound() {
    uint ret = XapianPINVOKE.Database_GetDoclengthUpperBound(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetWdfUpperBound(string term) {
    uint ret = XapianPINVOKE.Database_GetWdfUpperBound(swigCPtr, term);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public ValueIterator ValuestreamBegin(uint slot) {
    ValueIterator ret = new ValueIterator(XapianPINVOKE.Database_ValuestreamBegin(swigCPtr, slot), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public ValueIterator ValuestreamEnd(uint arg0) {
    ValueIterator ret = new ValueIterator(XapianPINVOKE.Database_ValuestreamEnd(swigCPtr, arg0), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public double GetDocLength(uint docid) {
    double ret = XapianPINVOKE.Database_GetDocLength(swigCPtr, docid);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void KeepAlive() {
    XapianPINVOKE.Database_KeepAlive(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public Document GetDocument(uint did) {
    Document ret = new Document(XapianPINVOKE.Database_GetDocument(swigCPtr, did), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string GetSpellingSuggestion(string word, uint max_edit_distance) {
    string ret = XapianPINVOKE.Database_GetSpellingSuggestion__SWIG_0(swigCPtr, word, max_edit_distance);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string GetSpellingSuggestion(string word) {
    string ret = XapianPINVOKE.Database_GetSpellingSuggestion__SWIG_1(swigCPtr, word);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator SpellingsBegin() {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_SpellingsBegin(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator SpellingsEnd() {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_SpellingsEnd(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator SynonymsBegin(string term) {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymsBegin(swigCPtr, term), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator SynonymsEnd(string arg0) {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymsEnd(swigCPtr, arg0), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator SynonymKeysBegin(string prefix) {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymKeysBegin__SWIG_0(swigCPtr, prefix), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator SynonymKeysBegin() {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymKeysBegin__SWIG_1(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator SynonymKeysEnd(string prefix) {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymKeysEnd__SWIG_0(swigCPtr, prefix), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator SynonymKeysEnd() {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_SynonymKeysEnd__SWIG_1(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string GetMetadata(string key) {
    string ret = XapianPINVOKE.Database_GetMetadata(swigCPtr, key);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator MetadataKeysBegin(string prefix) {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_MetadataKeysBegin__SWIG_0(swigCPtr, prefix), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator MetadataKeysBegin() {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_MetadataKeysBegin__SWIG_1(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator MetadataKeysEnd(string prefix) {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_MetadataKeysEnd__SWIG_0(swigCPtr, prefix), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator MetadataKeysEnd() {
    TermIterator ret = new TermIterator(XapianPINVOKE.Database_MetadataKeysEnd__SWIG_1(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string GetUuid() {
    string ret = XapianPINVOKE.Database_GetUuid(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}