lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Karman <>
Subject [lucy-user] ANNOUNCE: Dezi and Dezi::Client
Date Fri, 30 Sep 2011 14:31:14 GMT
Initial releases of Dezi and Dezi::Client are now on CPAN:

Dezi is a search platform built on Swish3, Apache Lucy, Search::OpenSearch and
Plack. Dezi provides a RESTful HTTP interface to Lucy indexes.

>From the SYNOPSIS:

Start the Dezi server, listening on port 5000:

 % dezi -p 5000

Add a document to the index:

 % curl http://localhost:5000/index/foo -XPOST \
   -d '<doc><title>bar</title>hello world</doc>' \
   -H 'Content-Type: application/xml'

Search the index:

 % curl 'http://localhost:5000/search?q=bar'

Or instead of curl one-liners, use the Dezi::Client:

use Dezi::Client;

# open a connection
my $client = Dezi::Client->new(
   server  => 'http://localhost:5000',

# add/update a filesystem document to the index
$client->index( 'path/to/file.html' );

# add/update an in-memory document to the index
$client->index( \$html_doc, uri => 'foo/bar.html' );

# add/update a Dezi::Doc to the index
$client->index( $dezi_doc );

# remove a document from the index
$client->delete( '/doc/uri/relative/to/index' );

# search the index
my $response = $client->search( q => 'foo' );

# iterate over results
for my $result (@{ $response->results }) {
    printf("--\n uri: %s\n title: %s\n score: %s\n",
       $result->uri, $result->title, $result->score);

# print stats
printf("       hits: %d\n", $response->total);
printf("search time: %s\n", $response->search_time);
printf(" build time: %s\n", $response->build_time);
printf("      query: %s\n", $response->query);

Peter Karman  .  .

View raw message