NAME
Search::Xapian - Perl XS frontend to the Xapian C++ search library.
SYNOPSIS
use Search::Xapian;
my $db = Search::Xapian::Database->new( '[DATABASE DIR]' );
my $enq = $db->enquire( '[QUERY TERM]' );
printf "Running query '%s'\n", $enq->get_query()->get_description();
my @matches = $enq->matches(0, 10);
print scalar(@matches) . " results found\n";
foreach my $match ( @matches ) {
my $doc = $match->get_document();
printf "ID %d %d%% [ %s ]\n", $match->get_docid(), $match->get_percent(), $doc->get_data();
}
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 - as demonstrated above.
The Xapian library is evolving very quickly at the time of writing, hence any documentation placed here would be likely to become out of date quite rapidly, and I do not have the patience to write some which could rapidly become redundant.
Apologies to those of you considering using this module. For the time being, I would suggest garnering what you can from the tests and examples provided, or reading through the Xapian documentation on http://www.xapian.org/, notably the API documentation at http://www.xapian.org/docs/apidoc/html/annotated.html
If you encounter problems, email either me or preferably the Xapian-discuss mailing list (which I am on - subscription details can be found on the Xapian web site).
EXPORT
None by default.
:db
- DB_OPEN
-
Open a database, fail if database doesn't exist.
- DB_CREATE
-
Create a new database, fail if database exists.
- DB_CREATE_OR_OPEN
-
open the existing database, without destorying data, or create new.
- DB_CREATE_OR_OVERWRITE
-
overwrite database if it exists
:ops
- OP_AND
-
Match if both subqueries are satisfied
- OP_OR
-
Match if either subquery is satisfied.
- OP_AND_NOT
-
Match if left but not right subquery is satisfied.
- OP_XOR
-
Match if left or right, but not both queries are satisfied.
- OP_AND_MAYBE
-
Match if left is satisfied, but use weights from both.
- OP_FILTER
-
Like OP_AND, but only weight using the left query.
- OP_NEAR
-
Match if the words are near eachother. The window should be specified, as a parameter to
Search::Xapian::Query::Query
. but it defaults to the number of terms in the list. - OP_PHRASE
-
Match as a phrase (All words in order).
- OP_ELITE_SET
-
Select an elite set from the subqueries, and perform a query with these combined as an OR query.
:standard
Standard is db + ops
TODO
- Error Handling
-
Error handling for all methods liable to generate them.
- Documentation
-
Brief descriptions of classes, possibly just adapted from Xapian docs.
- Unwrapped classes
-
The following Xapian classes are not yet wrapped: Error (and subclasses), ErrorHandler, ExpandDecider (and subclasses), MatchDecider, Weight (and subclasses).
- Unwrapped methods
-
The following methods are not yet wrapped: Enquire::get_eset(...) with more than two arguments, Enquire::get_mset(...) with more than two arguments, Enquire::register_match_decider(...) with one argument, Enquire::set_weighting_scheme(const Weight &weight); Query::Query(tname, ...); with more than one argument, Query itor ctor optional "parameter" parameter, Remote::open(...), static Stem::get_available_languages().
We wrap ESet::back(), MSet::swap() and MSet::operator[](), but not MSet::back(), ESet::swap(), ESet::operator[]().
Tie MSet and ESet to allow them to just be used as lists?
CREDITS
Thanks to Tye McQueen <tye@metronet.com> for explaining the finer points of how best to write XS frontends to C++ libraries, James Aylett <james@tartarus.org> for clarifying the less obvious aspects of the Xapian API, Tim Brody for patches wrapping ::QueryParser and ::Stopper and especially Olly Betts <olly@survex.com> for contributing advice, bugfixes, and wrapper code for the more obscure classes.
AUTHOR
Alex Bowley <kilinrax@cpan.org>
SEE ALSO
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 270:
You forgot a '=back' before '=head1'