NAME

CLucene - Perl interface to CLucene C++ search engine

SYNOPSIS

use CLucene;
my $cl = CLucene->new( path => "./index" );

# create index
$cl->open( path => "./index", create => 1 );

# add document to index
$cl->new_document;
$cl->add_field( field => "ref", value => "doc1");
$cl->add_field( field => "cnt", value => "some content");
$cl->add_date ( field => "add_dt", value => time );
$cl->insert_document or confess "Failed to insert document";
$cl->close;

# search index
$cl->open( path => "./index", create => 0 );
$cl->search( query => "some", field => "cnt" ) or confess "Search failed";
my $hitcount = $cl->hitcount;
while ($hitcount--)
{
  (my $ret,my $valref,my $valreflen) = $cl->getfield( field => "ref" );
	 confess "Failed getfield ref" unless $ret;
	 ($ret,my $valcnt,my $valcntlen) = $cl->getfield( field => "cnt" );
  confess "Failed getfield cnt" unless $ret;
  my $valadddt = $cl->getdatefield( field => "add_dt" )
    or confess "Failed getdatefield add_dt";
  my $hitscore = $cl->hitscore;
  print("Document: ref: [$valreflen] $valref, cnt: [$valcntlen] $valcnt, add_dt: $valadddt, hitscore: $hitscore\n");
  $cl->nexthit;
}
$cl->close;

# multi field search
$cl->searchmultifieldsflagged( query => "some", fields_aptr => ["cnt"],
    flags_aptr => [ $cl->NORMAL_FIELD ] )
  or confess "searchmultifieldsflagged failed";

ABSTRACT

Index and search documents across one or more fields using the CLucene fulltext search engine, a C++ version of the Java Lucene search engine.

DESCRIPTION

A perl interface to the CLucene C++ port of the Java Lucene search engine. See the documentation with CLucene http://sourceforge.net/projects/clucene/ and Lucene http://jakarta.apache.org/lucene/ for further details.

SEE ALSO

htDig - http://www.htdig.org/

Plucene - http://search.cpan.org/perldoc?Plucene

Search::FreeText - http://search.cpan.org/~snkwatt/Search-FreeText-0.05/

GNU mifluz - http://www.gnu.org/software/mifluz/

AUTHOR

Peter Edwards

COPYRIGHT AND LICENSE

Copyright 2005 by Peter Edwards <peterdragon@users.sourceforge.net>

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