File: index.html

package info (click to toggle)
xapian-bindings 1.2.12-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 13,676 kB
  • sloc: cpp: 210,519; sh: 10,953; cs: 5,969; python: 5,708; java: 5,537; php: 3,259; perl: 3,227; makefile: 1,010; ruby: 497; tcl: 250
file content (430 lines) | stat: -rw-r--r-- 15,492 bytes parent folder | download | duplicates (2)
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
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Search::Xapian - Perl frontend to the Xapian C++ search library.</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<ul>

		<li><a href="#export">EXPORT</a></li>
	</ul>

	<li><a href="#_db">:db</a></li>
	<li><a href="#_ops">:ops</a></li>
	<li><a href="#_qpflags">:qpflags</a></li>
	<li><a href="#_qpstem">:qpstem</a></li>
	<li><a href="#_enq_order">:enq_order</a></li>
	<li><a href="#_standard">:standard</a></li>
	<li><a href="#version_functions">Version functions</a></li>
	<li><a href="#numeric_encoding_functions">Numeric encoding functions</a></li>
	<li><a href="#todo">TODO</a></li>
	<li><a href="#credits">CREDITS</a></li>
	<li><a href="#author">AUTHOR</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
  use Search::Xapian;</pre>
<pre>
  my $db = Search::Xapian::Database-&gt;new( '[DATABASE DIR]' );
  my $enq = $db-&gt;enquire( '[QUERY TERM]' );</pre>
<pre>
  printf &quot;Running query '%s'\n&quot;, $enq-&gt;get_query()-&gt;get_description();</pre>
<pre>
  my @matches = $enq-&gt;matches(0, 10);</pre>
<pre>
  print scalar(@matches) . &quot; results found\n&quot;;</pre>
<pre>
  foreach my $match ( @matches ) {
    my $doc = $match-&gt;get_document();
    printf &quot;ID %d %d%% [ %s ]\n&quot;, $match-&gt;get_docid(), $match-&gt;get_percent(), $doc-&gt;get_data();
  }</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This module wraps most methods of most Xapian classes. The missing classes
and methods should be added in the future. It also provides a simplified,
more 'perlish' interface to some common operations, as demonstrated above.</p>
<p>There are some gaps in the POD documentation for wrapped classes, but you
can read the Xapian C++ API documentation at
<a href="http://xapian.org/docs/apidoc/html/annotated.html">http://xapian.org/docs/apidoc/html/annotated.html</a> for details of
these.  Alternatively, take a look at the code in the examples and tests.</p>
<p>If you want to use Search::Xapian and the threads module together, make
sure you're using Search::Xapian &gt;= 1.0.4.0 and Perl &gt;= 5.8.7.  As of 1.0.4.0,
Search::Xapian uses CLONE_SKIP to make sure that the perl wrapper objects
aren't copied to new threads - without this the underlying C++ objects can get
destroyed more than once.</p>
<p>If you encounter problems, or have any comments, suggestions, patches, etc
please email the Xapian-discuss mailing list (details of which can be found at
<a href="http://xapian.org/lists">http://xapian.org/lists</a>).</p>
<p>
</p>
<h2><a name="export">EXPORT</a></h2>
<p>None by default.</p>
<p>
</p>
<hr />
<h1><a name="_db">:db</a></h1>
<dl>
<dt><strong><a name="db_open" class="item">DB_OPEN</a></strong></dt>

<dd>
<p>Open a database, fail if database doesn't exist.</p>
</dd>
<dt><strong><a name="db_create" class="item">DB_CREATE</a></strong></dt>

<dd>
<p>Create a new database, fail if database exists.</p>
</dd>
<dt><strong><a name="db_create_or_open" class="item">DB_CREATE_OR_OPEN</a></strong></dt>

<dd>
<p>Open an existing database, without destroying data, or create a new
database if one doesn't already exist.</p>
</dd>
<dt><strong><a name="db_create_or_overwrite" class="item">DB_CREATE_OR_OVERWRITE</a></strong></dt>

<dd>
<p>Overwrite database if it exists.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="_ops">:ops</a></h1>
<dl>
<dt><strong><a name="op_and" class="item">OP_AND</a></strong></dt>

<dd>
<p>Match if both subqueries are satisfied.</p>
</dd>
<dt><strong><a name="op_or" class="item">OP_OR</a></strong></dt>

<dd>
<p>Match if either subquery is satisfied.</p>
</dd>
<dt><strong><a name="op_and_not" class="item">OP_AND_NOT</a></strong></dt>

<dd>
<p>Match if left but not right subquery is satisfied.</p>
</dd>
<dt><strong><a name="op_xor" class="item">OP_XOR</a></strong></dt>

<dd>
<p>Match if left or right, but not both queries are satisfied.</p>
</dd>
<dt><strong><a name="op_and_maybe" class="item">OP_AND_MAYBE</a></strong></dt>

<dd>
<p>Match if left is satisfied, but use weights from both.</p>
</dd>
<dt><strong><a name="op_filter" class="item">OP_FILTER</a></strong></dt>

<dd>
<p>Like OP_AND, but only weight using the left query.</p>
</dd>
<dt><strong><a name="op_near" class="item">OP_NEAR</a></strong></dt>

<dd>
<p>Match if the words are near each other. The window should be specified, as
a parameter to <code>Search::Xapian::Query::Query</code>, but it defaults to the
number of terms in the list.</p>
</dd>
<dt><strong><a name="op_phrase" class="item">OP_PHRASE</a></strong></dt>

<dd>
<p>Match as a phrase (All words in order).</p>
</dd>
<dt><strong><a name="op_elite_set" class="item">OP_ELITE_SET</a></strong></dt>

<dd>
<p>Select an elite set from the subqueries, and perform a query with these combined as an OR query.</p>
</dd>
<dt><strong><a name="op_value_range" class="item">OP_VALUE_RANGE</a></strong></dt>

<dd>
<p>Filter by a range test on a document value.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="_qpflags">:qpflags</a></h1>
<dl>
<dt><strong><a name="flag_default" class="item">FLAG_DEFAULT</a></strong></dt>

<dd>
<p>This gives the QueryParser default flag settings, allowing you to easily add
flags to the default ones.</p>
</dd>
<dt><strong><a name="flag_boolean" class="item">FLAG_BOOLEAN</a></strong></dt>

<dd>
<p>Support AND, OR, etc and bracketted subexpressions.</p>
</dd>
<dt><strong><a name="flag_lovehate" class="item">FLAG_LOVEHATE</a></strong></dt>

<dd>
<p>Support + and -.</p>
</dd>
<dt><strong><a name="flag_phrase" class="item">FLAG_PHRASE</a></strong></dt>

<dd>
<p>Support quoted phrases.</p>
</dd>
<dt><strong><a name="flag_boolean_any_case" class="item">FLAG_BOOLEAN_ANY_CASE</a></strong></dt>

<dd>
<p>Support AND, OR, etc even if they aren't in ALLCAPS.</p>
</dd>
<dt><strong><a name="flag_wildcard" class="item">FLAG_WILDCARD</a></strong></dt>

<dd>
<p>Support right truncation (e.g. Xap*).</p>
</dd>
<dt><strong><a name="flag_pure_not" class="item">FLAG_PURE_NOT</a></strong></dt>

<dd>
<p>Allow queries such as 'NOT apples'.</p>
<p>These require the use of a list of all documents in the database
which is potentially expensive, so this feature isn't enabled by
default.</p>
</dd>
<dt><strong><a name="flag_partial" class="item">FLAG_PARTIAL</a></strong></dt>

<dd>
<p>Enable partial matching.</p>
<p>Partial matching causes the parser to treat the query as a
&quot;partially entered&quot; search.  This will automatically treat the
final word as a wildcarded match, unless it is followed by
whitespace, to produce more stable results from interactive
searches.</p>
</dd>
<dt><strong><a name="flag_spelling_correction" class="item">FLAG_SPELLING_CORRECTION</a></strong></dt>

<dt><strong><a name="flag_synonym" class="item">FLAG_SYNONYM</a></strong></dt>

<dt><strong><a name="flag_auto_synonyms" class="item">FLAG_AUTO_SYNONYMS</a></strong></dt>

<dt><strong><a name="flag_auto_multiword_synonyms" class="item">FLAG_AUTO_MULTIWORD_SYNONYMS</a></strong></dt>

</dl>
<p>
</p>
<hr />
<h1><a name="_qpstem">:qpstem</a></h1>
<dl>
<dt><strong><a name="stem_all" class="item">STEM_ALL</a></strong></dt>

<dd>
<p>Stem all terms.</p>
</dd>
<dt><strong><a name="stem_none" class="item">STEM_NONE</a></strong></dt>

<dd>
<p>Don't stem any terms.</p>
</dd>
<dt><strong><a name="stem_some" class="item">STEM_SOME</a></strong></dt>

<dd>
<p>Stem some terms, in a manner compatible with Omega (capitalised words and those
in phrases aren't stemmed).</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="_enq_order">:enq_order</a></h1>
<dl>
<dt><strong><a name="enq_ascending" class="item">ENQ_ASCENDING</a></strong></dt>

<dd>
<p>docids sort in ascending order (default)</p>
</dd>
<dt><strong><a name="enq_descending" class="item">ENQ_DESCENDING</a></strong></dt>

<dd>
<p>docids sort in descending order</p>
</dd>
<dt><strong><a name="enq_dont_care" class="item">ENQ_DONT_CARE</a></strong></dt>

<dd>
<p>docids sort in whatever order is most efficient for the backend</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="_standard">:standard</a></h1>
<p>Standard is db + ops + qpflags + qpstem</p>
<p>
</p>
<hr />
<h1><a name="version_functions">Version functions</a></h1>
<dl>
<dt><strong><a name="major_version" class="item">major_version</a></strong></dt>

<dd>
<p>Returns the major version of the Xapian C++ library being used.  E.g. for
Xapian 1.0.9 this would return 1.</p>
</dd>
<dt><strong><a name="minor_version" class="item">minor_version</a></strong></dt>

<dd>
<p>Returns the minor version of the Xapian C++ library being used.  E.g. for
Xapian 1.0.9 this would return 0.</p>
</dd>
<dt><strong><a name="revision" class="item">revision</a></strong></dt>

<dd>
<p>Returns the revision of the Xapian C++ library being used.  E.g. for
Xapian 1.0.9 this would return 9.  In a stable release series, Xapian libraries
with the same minor and major versions are usually ABI compatible, so this
often won't match the third component of $Search::Xapian::VERSION (which is the
version of the Search::Xapian wrappers).</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="numeric_encoding_functions">Numeric encoding functions</a></h1>
<dl>
<dt><strong><a name="sortable_serialise" class="item">sortable_serialise NUMBER</a></strong></dt>

<dd>
<p>Convert a floating point number to a string, preserving sort order.</p>
<p>This method converts a floating point number to a string, suitable for
using as a value for numeric range restriction, or for use as a sort
key.</p>
<p>The conversion is platform independent.</p>
<p>The conversion attempts to ensure that, for any pair of values supplied
to the conversion algorithm, the result of comparing the original
values (with a numeric comparison operator) will be the same as the
result of comparing the resulting values (with a string comparison
operator).  On platforms which represent doubles with the precisions
specified by IEEE_754, this will be the case: if the representation of
doubles is more precise, it is possible that two very close doubles
will be mapped to the same string, so will compare equal.</p>
<p>Note also that both zero and -zero will be converted to the same
representation: since these compare equal, this satisfies the
comparison constraint, but it's worth knowing this if you wish to use
the encoding in some situation where this distinction matters.</p>
<p>Handling of NaN isn't (currently) guaranteed to be sensible.</p>
</dd>
<dt><strong><a name="sortable_unserialise_serialised_number" class="item">sortable_unserialise SERIALISED_NUMBER</a></strong></dt>

<dd>
<p>Convert a string encoded using sortable_serialise back to a floating
point number.</p>
<p>This expects the input to be a string produced by <a href="#sortable_serialise"><code>sortable_serialise()</code></a>.
If the input is not such a string, the value returned is undefined (but
no error will be thrown).</p>
<p>The result of the conversion will be exactly the value which was
supplied to <a href="#sortable_serialise"><code>sortable_serialise()</code></a> when making the string on platforms
which represent doubles with the precisions specified by IEEE_754, but
may be a different (nearby) value on other platforms.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="todo">TODO</a></h1>
<dl>
<dt><strong><a name="error_handling" class="item">Error Handling</a></strong></dt>

<dd>
<p>Error handling for all methods liable to generate them.</p>
</dd>
<dt><strong><a name="documentation" class="item">Documentation</a></strong></dt>

<dd>
<p>Add POD documentation for all classes, where possible just adapted from Xapian
docs.</p>
</dd>
<dt><strong><a name="unwrapped_classes" class="item">Unwrapped classes</a></strong></dt>

<dd>
<p>The following Xapian classes are not yet wrapped:
Error (and subclasses), ErrorHandler, ExpandDecider (and subclasses),
user-defined weight classes.</p>
<p>We don't yet wrap Xapian::BAD_VALUENO.</p>
</dd>
<dt><strong><a name="unwrapped_methods" class="item">Unwrapped methods</a></strong></dt>

<dd>
<p>The following methods are not yet wrapped:
Enquire::get_eset(...) with more than two arguments,
Query ctor optional &quot;parameter&quot; parameter,
Remote::open(...),
static Stem::get_available_languages().</p>
<p>We wrap MSet::swap() and MSet::operator[](), but not ESet::swap(),
ESet::operator[]().  Is swap actually useful?  Should we instead tie MSet
and ESet to allow them to just be used as lists?</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="credits">CREDITS</a></h1>
<p>Thanks to Tye McQueen &lt;<a href="mailto:tye@metronet.com">tye@metronet.com</a>&gt; for explaining the
finer points of how best to write XS frontends to C++ libraries, James
Aylett &lt;<a href="mailto:james@tartarus.org">james@tartarus.org</a>&gt; for clarifying the less obvious
aspects of the Xapian API, Tim Brody for patches wrapping ::QueryParser and
::Stopper and especially Olly Betts &lt;<a href="mailto:olly@survex.com">olly@survex.com</a>&gt; for contributing
advice, bugfixes, and wrapper code for the more obscure classes.</p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Alex Bowley &lt;<a href="mailto:kilinrax@cpan.org">kilinrax@cpan.org</a>&gt;</p>
<p>Please report any bugs/suggestions to &lt;<a href="mailto:xapian-discuss@lists.xapian.org">xapian-discuss@lists.xapian.org</a>&gt;
or use the Xapian bug tracker <a href="http://xapian.org/bugs">http://xapian.org/bugs</a>.  Please do
NOT use the CPAN bug tracker or mail any of the authors individually.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><a href="/Search/Xapian/BM25Weight.html">the Search::Xapian::BM25Weight manpage</a>,
<a href="/Search/Xapian/BoolWeight.html">the Search::Xapian::BoolWeight manpage</a>,
<a href="/Search/Xapian/Database.html">the Search::Xapian::Database manpage</a>,
<a href="/Search/Xapian/Document.html">the Search::Xapian::Document manpage</a>,
<a href="/Search/Xapian/Enquire.html">the Search::Xapian::Enquire manpage</a>,
<a href="/Search/Xapian/MultiValueSorter.html">the Search::Xapian::MultiValueSorter manpage</a>,
<a href="/Search/Xapian/PositionIterator.html">the Search::Xapian::PositionIterator manpage</a>,
<a href="/Search/Xapian/PostingIterator.html">the Search::Xapian::PostingIterator manpage</a>,
<a href="/Search/Xapian/QueryParser.html">the Search::Xapian::QueryParser manpage</a>,
<a href="/Search/Xapian/Stem.html">the Search::Xapian::Stem manpage</a>,
<a href="/Search/Xapian/TermGenerator.html">the Search::Xapian::TermGenerator manpage</a>,
<a href="/Search/Xapian/TermIterator.html">the Search::Xapian::TermIterator manpage</a>,
<a href="/Search/Xapian/TradWeight.html">the Search::Xapian::TradWeight manpage</a>,
<a href="/Search/Xapian/ValueIterator.html">the Search::Xapian::ValueIterator manpage</a>,
<a href="/Search/Xapian/Weight.html">the Search::Xapian::Weight manpage</a>,
<a href="/Search/Xapian/WritableDatabase.html">the Search::Xapian::WritableDatabase manpage</a>,
and
<a href="http://xapian.org/">http://xapian.org/</a>.</p>

</body>

</html>