Skip to content

Instantly share code, notes, and snippets.

@logie17
Created September 22, 2011 23:47
Show Gist options
  • Save logie17/1236376 to your computer and use it in GitHub Desktop.
Save logie17/1236376 to your computer and use it in GitHub Desktop.
An example indexer using Lucy::Simple
#! /usr/bin/env perl
# Example from https://metacpan.org/module/Lucy::Simple
use Lucy::Simple;
my $index = Lucy::Simple->new(
path => './index',
language => 'en',
);
my %source_docs = (
'Foo' => 'I am a page about birds that fly high in the sky',
'Bar' => 'This is a page about whales that hold their breath in the sea'
);
while ( my ( $title, $content ) = each %source_docs ) {
$index->add_doc({
page => $title,
content => $content,
});
}
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment