The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Dezi::Searcher - base searcher class

SYNOPSIS

 my $searcher = Dezi::Searcher->new(
                    invindex        => 'path/to/index',
                    max_hits        => 1000,
                );
                
 my $results = $searcher->search( 'foo bar' );
 while (my $result = $results->next) {
     printf("%4d %s\n", $result->score, $result->uri);
 }

DESCRIPTION

Dezi::Searcher is a base searcher class. It defines the APIs that all Dezi storage backends adhere to in returning results from a Dezi::InvIndex.

METHODS

BUILD

Build searcher object. Called internally by new().

invindex

A Dezi::InvIndex object or directory path. Required. Set in new().

May be a single value or an array ref of values (for searching multiple indexes at once).

max_hits

The maximum number of hits to return. Optional. Default is 1000.

qp_config

Optional hashref passed to Search::Query::Parser->new().

invindex_class

Returns string 'Dezi::InvIndex'. Override this in a subclass to indicate the corresponding InvIndex class for your Searcher.

init_qp_config

Returns empty hashref by default. Override this to provide custom default config for the qp (Search::Query::Parser).

init_qp

Returns Search::Query::Parser->new( $self->init_qp_config ) by default. Override in a subclass to customize the Search::Query::Parser object.

search( query, opts )

Returns a Dezi::Results object.

query should be a Search::Query::Dialect object or a string parse-able by Search::Query::Parser.

opts should be a Dezi::Searcher::SearchOpts object or a hashref.

property_map

Build from the InvIndex::Header, a hashref of property aliases to real names. A read-only attribute propagated to the Results from search().

AUTHOR

Peter Karman, <karpet@dezi.org>

BUGS

Please report any bugs or feature requests to bug-dezi-app at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dezi-App. 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 Dezi::Searcher

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright 2014 by Peter Karman

This library is free software; you can redistribute it and/or modify it under the terms of the GPL v2 or later.

SEE ALSO

http://dezi.org/, http://swish-e.org/, http://lucy.apache.org/