KinoSearch(3) search engine library

VERSION

0.165

BACKWARDS COMPATIBILITY POLICY

KinoSearch is officially ``alpha'' software, mostly because the file format may be changed in the future. If you have an incremental indexing app set up when that change arrives, and your sysadmin upgrades KinoSearch unaware of that, your app will suddenly start crashing. Until the file format issue is settled, changes to the API are also fair game.

However, if you are in a position to control module installation on your machine and you can test your apps when upgrading, KinoSearch is easily stable and mature enough for heavy use.

SYNOPSIS

First, write an application to build an inverted index, or ``invindex'', from your document collection.


use KinoSearch::InvIndexer;
use KinoSearch::Analysis::PolyAnalyzer;

my $analyzer
= KinoSearch::Analysis::PolyAnalyzer->new( language => 'en' );

my $invindexer = KinoSearch::InvIndexer->new(
invindex => '/path/to/invindex',
create => 1,
analyzer => $analyzer,
);

$invindexer->spec_field(
name => 'title',
boost => 3,
);
$invindexer->spec_field( name => 'bodytext' );

while ( my ( $title, $bodytext ) = each %source_documents ) {
my $doc = $invindexer->new_doc;

$doc->set_value( title => $title );
$doc->set_value( bodytext => $bodytext );

$invindexer->add_doc($doc);
}

$invindexer->finish;

Then, write a second application to search the invindex:

    use KinoSearch::Searcher;
    use KinoSearch::Analysis::PolyAnalyzer;
    
    my $analyzer
        = KinoSearch::Analysis::PolyAnalyzer->new( language => 'en' );
    
    my $searcher = KinoSearch::Searcher->new(
        invindex => '/path/to/invindex',
        analyzer => $analyzer,
    );
    
    my $hits = $searcher->search( query => "foo bar" );
    while ( my $hit = $hits->fetch_hit_hashref ) {
        print "$hit->{title}\n";
    }

DESCRIPTION

KinoSearch is a loose port of the Java search engine library Apache Lucene, written in Perl and C. The archetypal application is website search, but it can be put to many different uses.

Features

  • Extremely fast and scalable - can handle millions of documents
  • Incremental indexing (addition/deletion of documents to/from an existing index).
  • Full support for 12 Indo-European languages.
  • Support for boolean operators AND, OR, and AND NOT; parenthetical groupings, and prepended +plus and -minus
  • Algorithmic selection of relevant excerpts and highlighting of search terms within excerpts
  • Highly customizable query and indexing APIs
  • Phrase matching
  • Stemming
  • Stoplists

Getting Started

KinoSearch has many, many classes, but you only need to get aquainted with three to start with:
  • KinoSearch::InvIndexer
  • KinoSearch::Searcher
  • KinoSearch::Analysis::PolyAnalyzer

Probably the quickest way to get something up and running is to cut and paste the sample applications out of KinoSearch::Docs::Tutorial and adapt them for your purposes.

History

Search::Kinosearch 0.02x, now deprecated, is this suite's forerunner. Plucene is a pure-Perl port of Lucene 1.3. KinoSearch is a from-scratch project which attempts to draws on the lessons of both. The API is not compatible with either.

KinoSearch is named for Kino, the main character in John Steinbeck's novella, ``The Pearl''.

SUPPORT

Please direct support questions to the kinosearch mailing list: subscription information at <http://www.rectangular.com/kinosearch>.

AUTHORS

Marvin Humphrey, <marvin at rectangular dot com>

Apache Lucene by Doug Cutting et al.

BUGS

Not thread-safe.

Will not work on a Cray.

Please report any other bugs or feature requests to "[email protected]", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=KinoSearch>.

COPYRIGHT & LICENSE

Copyright 2005-2009 Marvin Humphrey

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Terms of usage for Apache Lucene, from which portions of KinoSearch are derived, are spelled out in the Apache License: see the file ``ApacheLicense2.0.txt''.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.