Category Archives: apache-lucy

Indexation and searching with Lucy

I am trying to index a folder with text files, and search the files which contain a word using lucy::simple module. Here is my code so far:


use strict;
use warnings;
use Lucy::Simple;
use Lucy::Search::IndexSearcher;


    my $index = Lucy::Simple->new(
        path     => "/home/akpinar/Desktop/lucyindex/text",
        language => 'en',

    while ( my ( $title, $content ) = each my %source_docs ) {
        my $index->add_doc({
            title    => $title,
            content  => $content,
    #print "Indexation finie\n"; 

    print "Veuillez taper votre requĂȘte : \n"; 
    my $requete = <STDIN>;
    chomp $requete ; 

    my $nbTrouve = $index->search(
        query =>$requete, 

    print "Total hits: $nbTrouve\n";
    while ( my $hit = $index->next ) {
        print "$hit->{title}\n",

but i get the error: Failed to read seg_1 S_try_open_elements at core/Lucy/Index/PolyReader.c line 290 at line 21, line 1. eval {...} called at line 21 lucy_PolyReader_do_open at core/Lucy/Index/PolyReader.c line 439 at line 21, line 1.

Does anybody know why I get this?

Apache solr vs Apache Lucy

I have a web application written in Perl. My search requirement is to index a file system / on fly document which can contains file types i.e.; HTML, MS Office, PDF documents etc and then perform a full-text search. I have already investigated Apache Solr works fine with sample data. Now I got to know about Apache Lucy and wondering if this is the right candidate for my Perl based application. One of the concern with Apache Lucy this is that there is no update on CPAN after Dec 2014. Not sure if this is actively maintained especially what is the progress with integration with Lucene 5.3. I need suggestion on below points: