NAME
Search::OpenSearch::Engine::Xapian - Xapian engine for OpenSearch results
SYNOPSIS
use Search::OpenSearch::Engine::Xapian;
my $engine = Search::OpenSearch::Engine::Xapian->new(
   index       => [qw( path/to/index1 path/to/index2 )],
   facets      => {
       names       => [qw( color size flavor )],
       sample_size => 10_000,
   },
   fields      => [qw( color size flavor )],   # result attributes in response
   indexer_config  => {
       somekey => somevalue,
   },
   searcher_config => {
       anotherkey => anothervalue,
   },
   cache           => CHI->new(
       driver           => 'File',
       dir_create_mode  => 0770,
       file_create_mode => 0660,
       root_dir         => "/tmp/opensearch_cache",
   ),
   cache_ttl       => 3600,
   do_not_hilite   => [qw( color )],
   snipper_config  => { as_sentences => 1 },        # see Search::Tools::Snipper
   hiliter_config  => { class => 'h', tag => 'b' }, # see Search::Tools::HiLiter
   parser_config   => {},                           # see Search::Query::Parser
   
);
my $response = $engine->search(
   q           => 'quick brown fox',   # query
   s           => 'rank desc',         # sort order
   o           => 0,                   # offset
   p           => 25,                  # page size
   h           => 1,                   # highlight query terms in results
   c           => 0,                   # count total only (same as f=0 r=0)
   L           => 'field|low|high',    # limit results to inclusive range
   f           => 1,                   # include facets
   r           => 1,                   # include results
   t           => 'XML',               # or JSON
   u           => 'http://yourdomain.foo/opensearch/',
   b           => 'AND',               # or OR
);
print $response;
DESCRIPTION
METHODS
init_searcher
Returns a SWISH::Prog::Xapian::Searcher object.
init_indexer
Returns a SWISH::Prog::Xapian::Indexer object (used by the REST API).
init_suggester
Returns undefined. Available to support Engine API.
get_allowed_http_methods
Returns array of GET, POST, PUT, DELETE. Available to support Engine API.
build_facets( query, results )
Returns hash ref of facets from results. See Search::OpenSearch::Engine.
process_result( args )
Overrides base method to preserve multi-value fields as arrays.
has_rest_api
Returns true.
PUT( doc )
POST( doc )
DELETE( uri )
GET( uri )
AUTHOR
Peter Karman, <karman at cpan.org>
BUGS
Please report any bugs or feature requests to bug-search-opensearch-engine-xapian at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Search-OpenSearch-Engine-Xapian. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Search::OpenSearch::Engine::Xapian
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Search-OpenSearch-Engine-Xapian
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
http://cpanratings.perl.org/d/Search-OpenSearch-Engine-Xapian
Search CPAN
http://search.cpan.org/dist/Search-OpenSearch-Engine-Xapian/
COPYRIGHT & LICENSE
Copyright 2011 Peter Karman.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.