.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Xapian 3" .TH Xapian 3 2024-09-01 "perl v5.40.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Search::Xapian \- Perl XS frontend to the Xapian C++ search library. .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Search::Xapian; \& \& my $db = Search::Xapian::Database\->new( \*(Aq[DATABASE DIR]\*(Aq ); \& my $enq = $db\->enquire( \*(Aq[QUERY TERM]\*(Aq ); \& \& printf "Running query \*(Aq%s\*(Aq\en", $enq\->get_query()\->get_description(); \& \& my @matches = $enq\->matches(0, 10); \& \& print scalar(@matches) . " results found\en"; \& \& foreach my $match ( @matches ) { \& my $doc = $match\->get_document(); \& printf "ID %d %d%% [ %s ]\en", $match\->get_docid(), $match\->get_percent(), $doc\->get_data(); \& } .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" 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. .PP There are some gaps in the POD documentation for wrapped classes, but you can read the Xapian C++ API documentation at for details of these. Alternatively, take a look at the code in the examples and tests. .PP If you want to use Search::Xapian and the threads module together, make sure you're using Search::Xapian >= 1.0.4.0 and Perl >= 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. .PP 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 ). .SS EXPORT .IX Subsection "EXPORT" None by default. .SH :db .IX Header ":db" .IP DB_OPEN 4 .IX Item "DB_OPEN" Open a database, fail if database doesn't exist. .IP DB_CREATE 4 .IX Item "DB_CREATE" Create a new database, fail if database exists. .IP DB_CREATE_OR_OPEN 4 .IX Item "DB_CREATE_OR_OPEN" Open an existing database, without destroying data, or create a new database if one doesn't already exist. .IP DB_CREATE_OR_OVERWRITE 4 .IX Item "DB_CREATE_OR_OVERWRITE" Overwrite database if it exists. .SH :ops .IX Header ":ops" .IP OP_AND 4 .IX Item "OP_AND" Match if both subqueries are satisfied. .IP OP_OR 4 .IX Item "OP_OR" Match if either subquery is satisfied. .IP OP_AND_NOT 4 .IX Item "OP_AND_NOT" Match if left but not right subquery is satisfied. .IP OP_XOR 4 .IX Item "OP_XOR" Match if left or right, but not both queries are satisfied. .IP OP_AND_MAYBE 4 .IX Item "OP_AND_MAYBE" Match if left is satisfied, but use weights from both. .IP OP_FILTER 4 .IX Item "OP_FILTER" Like OP_AND, but only weight using the left query. .IP OP_NEAR 4 .IX Item "OP_NEAR" Match if the words are near each other. The window should be specified, as a parameter to \f(CW\*(C`Search::Xapian::Query::Query\*(C'\fR, but it defaults to the number of terms in the list. .IP OP_PHRASE 4 .IX Item "OP_PHRASE" Match as a phrase (All words in order). .IP OP_ELITE_SET 4 .IX Item "OP_ELITE_SET" Select an elite set from the subqueries, and perform a query with these combined as an OR query. .IP OP_VALUE_RANGE 4 .IX Item "OP_VALUE_RANGE" Filter by a range test on a document value. .SH :qpflags .IX Header ":qpflags" .IP FLAG_DEFAULT 4 .IX Item "FLAG_DEFAULT" This gives the QueryParser default flag settings, allowing you to easily add flags to the default ones. .IP FLAG_BOOLEAN 4 .IX Item "FLAG_BOOLEAN" Support AND, OR, etc and bracketed subexpressions. .IP FLAG_LOVEHATE 4 .IX Item "FLAG_LOVEHATE" Support + and \-. .IP FLAG_PHRASE 4 .IX Item "FLAG_PHRASE" Support quoted phrases. .IP FLAG_BOOLEAN_ANY_CASE 4 .IX Item "FLAG_BOOLEAN_ANY_CASE" Support AND, OR, etc even if they aren't in ALLCAPS. .IP FLAG_WILDCARD 4 .IX Item "FLAG_WILDCARD" Support right truncation (e.g. Xap*). .IP FLAG_PURE_NOT 4 .IX Item "FLAG_PURE_NOT" Allow queries such as 'NOT apples'. .Sp 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. .IP FLAG_PARTIAL 4 .IX Item "FLAG_PARTIAL" Enable partial matching. .Sp Partial matching causes the parser to treat the query as a "partially entered" 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. .IP FLAG_SPELLING_CORRECTION 4 .IX Item "FLAG_SPELLING_CORRECTION" .PD 0 .IP FLAG_SYNONYM 4 .IX Item "FLAG_SYNONYM" .IP FLAG_AUTO_SYNONYMS 4 .IX Item "FLAG_AUTO_SYNONYMS" .IP FLAG_AUTO_MULTIWORD_SYNONYMS 4 .IX Item "FLAG_AUTO_MULTIWORD_SYNONYMS" .PD .SH :qpstem .IX Header ":qpstem" .IP STEM_ALL 4 .IX Item "STEM_ALL" Stem all terms. .IP STEM_NONE 4 .IX Item "STEM_NONE" Don't stem any terms. .IP STEM_SOME 4 .IX Item "STEM_SOME" Stem some terms, in a manner compatible with Omega (capitalised words and those in phrases aren't stemmed). .SH :enq_order .IX Header ":enq_order" .IP ENQ_ASCENDING 4 .IX Item "ENQ_ASCENDING" docids sort in ascending order (default) .IP ENQ_DESCENDING 4 .IX Item "ENQ_DESCENDING" docids sort in descending order .IP ENQ_DONT_CARE 4 .IX Item "ENQ_DONT_CARE" docids sort in whatever order is most efficient for the backend .SH :standard .IX Header ":standard" Standard is db + ops + qpflags + qpstem .SH "Version functions" .IX Header "Version functions" .IP major_version 4 .IX Item "major_version" Returns the major version of the Xapian C++ library being used. E.g. for Xapian 1.0.9 this would return 1. .IP minor_version 4 .IX Item "minor_version" Returns the minor version of the Xapian C++ library being used. E.g. for Xapian 1.0.9 this would return 0. .IP revision 4 .IX Item "revision" 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 \f(CW$Search::Xapian::VERSION\fR (which is the version of the Search::Xapian XS wrappers). .SH "Numeric encoding functions" .IX Header "Numeric encoding functions" .IP "sortable_serialise NUMBER" 4 .IX Item "sortable_serialise NUMBER" Convert a floating point number to a string, preserving sort order. .Sp 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. .Sp The conversion is platform independent. .Sp 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. .Sp 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. .Sp Handling of NaN isn't (currently) guaranteed to be sensible. .IP "sortable_unserialise SERIALISED_NUMBER" 4 .IX Item "sortable_unserialise SERIALISED_NUMBER" Convert a string encoded using sortable_serialise back to a floating point number. .Sp This expects the input to be a string produced by \fBsortable_serialise()\fR. If the input is not such a string, the value returned is undefined (but no error will be thrown). .Sp The result of the conversion will be exactly the value which was supplied to \fBsortable_serialise()\fR 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. .SH TODO .IX Header "TODO" .IP "Error Handling" 4 .IX Item "Error Handling" Error handling for all methods liable to generate them. .IP Documentation 4 .IX Item "Documentation" Add POD documentation for all classes, where possible just adapted from Xapian docs. .IP "Unwrapped classes" 4 .IX Item "Unwrapped classes" The following Xapian classes are not yet wrapped: ErrorHandler, standard ExpandDecider subclasses (user-defined ones works), user-defined weight classes. .IP "Unwrapped methods" 4 .IX Item "Unwrapped methods" The following methods are not yet wrapped: Enquire::get_eset(...) with more than two arguments, Query ctor optional "parameter" parameter, Remote::open(...), static \fBStem::get_available_languages()\fR. .Sp We wrap \fBMSet::swap()\fR and MSet::operator[](), but not \fBESet::swap()\fR, ESet::operator[](). Is swap actually useful? Should we instead tie MSet and ESet to allow them to just be used as lists? .SH CREDITS .IX Header "CREDITS" Thanks to Tye McQueen for explaining the finer points of how best to write XS frontends to C++ libraries, James Aylett for clarifying the less obvious aspects of the Xapian API, Tim Brody for patches wrapping ::QueryParser and ::Stopper and especially Olly Betts for contributing advice, bugfixes, and wrapper code for the more obscure classes. .SH AUTHOR .IX Header "AUTHOR" Alex Bowley .PP Please report any bugs/suggestions to or use the Xapian bug tracker . Please do NOT use the CPAN bug tracker or mail any of the authors individually. .SH LICENSE .IX Header "LICENSE" This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Search::Xapian::BM25Weight, Search::Xapian::BoolWeight, Search::Xapian::Database, Search::Xapian::Document, Search::Xapian::Enquire, Search::Xapian::MatchSpy, Search::Xapian::MultiValueSorter, Search::Xapian::PositionIterator, Search::Xapian::PostingIterator, Search::Xapian::QueryParser, Search::Xapian::Stem, Search::Xapian::TermGenerator, Search::Xapian::TermIterator, Search::Xapian::TradWeight, Search::Xapian::ValueIterator, Search::Xapian::Weight, Search::Xapian::WritableDatabase, and .