Peter Karman > SWISH-Prog-Lucy > SWISH::Prog::Lucy::Searcher

Download:
SWISH-Prog-Lucy-0.23.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.23   Source  

NAME ^

SWISH::Prog::Lucy::Searcher - search Swish3 Lucy backend

SYNOPSIS ^

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

DESCRIPTION ^

SWISH::Prog::Lucy::Searcher is an Apache Lucy based Searcher class for Swish3.

SWISH::Prog::Lucy::Searcher is not made to replace the more fully-featured Lucy::Search::Searcher class and its friends. Instead, SWISH::Prog::Lucy::Searcher provides a simple API similar to other SWISH::Prog::Searcher-based backends so that you can experiment with alternate storage engines without needing to change much code. When your search application requirements become more complex, the author recommends the switch to using Lucy::Search::Searcher directly.

METHODS ^

Only new and overridden methods are documented here. See the SWISH::Prog::Searcher documentation.

init

Called internally by new(). Additional parameters include:

find_relevant_fields 1|0

Set to true to have the Results object locate the fields that matched the query. Default is 0 (off).

qp search_query_parser_object

Optional. If passed, should be a Search::Query::Parser object. You can get/set the internal parser with the qp() method as well.

qp_config hash_ref

Optional. If set, the internal Search::Query::Parser object will be initialized with hash_ref.

nfs_mode 1|0

Set to true if your index is stored on a NFS filesystem. Extra locking precautions are implemented when this mode is on (1). Default is off (0).

get_propnames

Returns array ref of PropertyNames defined for the invindex. The array will not contain any alias names or reserved PropertyNames.

search( query [, opts ] )

Returns a SWISH::Prog::Lucy::Results object.

query is assumed to be query string compatible with Search::Query::Dialect::Lucy.

opts is an optional hashref with the following supported key/values:

start

The starting position. Default is 0.

max

The ending position. Default is max_hits() as documented in SWISH::Prog::Searcher.

order

Takes a SQL-like text string (like SWISH::Prog::Native::Searcher) or a Lucy::Search::SortSpec object, which will determine the sort order.

limit

Takes an arrayref of arrayrefs. Each child arrayref should have three values: a field (PropertyName) value, a lower limit and an upper limit.

default_boolop

The default boolean connector for parsing query. Valid values are AND and OR. The default is AND (which is different than Lucy::QueryParser, but the same as Swish-e).

get_unique_id

Returns string of all concatenated UUID values from the Searcher's invindex meta descriptions.

get_lucy

Returns the internal Lucy::Search::PolySearcher object.

AUTHOR ^

Peter Karman, <karman at cpan.org>

BUGS ^

Please report any bugs or feature requests to bug-swish-prog-lucy at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SWISH-Prog-Lucy. 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 SWISH::Prog::Lucy

You can also look for information at:

COPYRIGHT & LICENSE ^

Copyright 2009 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.

syntax highlighting: