Marvin Humphrey > Lucy > Lucy

Download:
Lucy-0.3.3.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Module Version: 0.003003   Source  

NAME ^

Lucy - Apache Lucy search engine library.

VERSION ^

0.3.3

SYNOPSIS ^

First, plan out your index structure, create the index, and add documents:

    # indexer.pl
    
    use Lucy::Index::Indexer;
    use Lucy::Plan::Schema;
    use Lucy::Analysis::PolyAnalyzer;
    use Lucy::Plan::FullTextType;
    
    # Create a Schema which defines index fields.
    my $schema = Lucy::Plan::Schema->new;
    my $polyanalyzer = Lucy::Analysis::PolyAnalyzer->new( 
        language => 'en',
    );
    my $type = Lucy::Plan::FullTextType->new(
        analyzer => $polyanalyzer,
    );
    $schema->spec_field( name => 'title',   type => $type );
    $schema->spec_field( name => 'content', type => $type );
    
    # Create the index and add documents.
    my $indexer = Lucy::Index::Indexer->new(
        schema => $schema,   
        index  => '/path/to/index',
        create => 1,
    );
    while ( my ( $title, $content ) = each %source_docs ) {
        $indexer->add_doc({
            title   => $title,
            content => $content,
        });
    }
    $indexer->commit;

Then, search the index:

    # search.pl
    
    use Lucy::Search::IndexSearcher;
    
    my $searcher = Lucy::Search::IndexSearcher->new( 
        index => '/path/to/index' 
    );
    my $hits = $searcher->hits( query => "foo bar" );
    while ( my $hit = $hits->next ) {
        print "$hit->{title}\n";
    }

DESCRIPTION ^

The Apache Lucy search engine library delivers high-performance, modular full-text search.

Features

Getting Started

Lucy::Simple provides a stripped down API which may suffice for many tasks.

Lucy::Docs::Tutorial demonstrates how to build a basic CGI search application.

The tutorial spends most of its time on these five classes:

Delving Deeper

Lucy::Docs::Cookbook augments the tutorial with more advanced recipes.

For creating complex queries, see Lucy::Search::Query and its subclasses TermQuery, PhraseQuery, ANDQuery, ORQuery, NOTQuery, RequiredOptionalQuery, MatchAllQuery, and NoMatchQuery, plus Lucy::Search::QueryParser.

For distributed searching, see LucyX::Remote::SearchServer, LucyX::Remote::SearchClient, and LucyX::Remote::ClusterSearcher.

Backwards Compatibility Policy

Lucy will spin off stable forks into new namespaces periodically. The first will be named "Lucy1". Users who require strong backwards compatibility should use a stable fork.

The main namespace, "Lucy", is an API-unstable development branch (as hinted at by its 0.x.x version number). Superficial interface changes happen frequently. Hard file format compatibility breaks which require reindexing are rare, as we generally try to provide continuity across multiple releases, but we reserve the right to make such changes.

CLASS METHODS ^

The Lucy module itself does not have a large interface, providing only a single public class method.

error

    my $instream = $folder->open_in( file => 'foo' ) or die Lucy->error;

Access a shared variable which is set by some routines on failure. It will always be either a Lucy::Object::Err object or undef.

SUPPORT ^

The Apache Lucy homepage, where you'll find links to our mailing lists and so on, is http://lucy.apache.org. Please direct support questions to the Lucy users mailing list.

BUGS ^

Not thread-safe.

Some exceptions leak memory.

If you find a bug, please inquire on the Lucy users mailing list about it, then report it on the Lucy issue tracker once it has been confirmed: https://issues.apache.org/jira/browse/LUCY.

COPYRIGHT ^

Apache Lucy is distributed under the Apache License, Version 2.0, as described in the file LICENSE included with the distribution.

syntax highlighting: