The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Search::Indexer::Incremental::MD5::Searcher - Search your indexed files

SYNOPSIS

  my $search_string = 'find_me' ;
  my $searcher = 
        eval 
        {
        Search::Indexer::Incremental::MD5::Searcher->new
                (
                USE_POSITIONS => 1, 
                INDEX_DIRECTORY => 'text_index', 
                get_perl_word_regex_and_stop_words(),
                )
        } or croak "No full text index found! $@\n" ;
  
  my $results = $searcher->search($search_string) ;
  
  # sort in decreasing score order
  my @indexes = map { $_->[0] }
                    reverse
                        sort { $a->[1] <=> $b->[1] }
                            map { [$_, $results->[$_]{SCORE}] }
                                0 .. $#$results ;
  
  for (@indexes)
        {
        print {* STDOUT} "$results->[$_]{PATH} [$results->[$_]{SCORE}].\n" ;
        }
        
  $searcher = undef ;
  

DESCRIPTION

This module implements an incremental text indexer and searcher based on Search::Indexer.

DOCUMENTATION

Given a list of files, this module will allow you to create an indexed text database that you can later query for matches. You can also use the siim command line application installed with this module.

SUBROUTINES/METHODS

new( %named_arguments)

Create a Search::Indexer::Incremental::MD5::Searcher object.

  my $indexer = new Search::Indexer::Incremental::MD5::Searcher(%named_arguments) ;

Arguments - %named_arguments

-

Returns - A Search::Indexer::Incremental::MD5::Searcher object

Exceptions -

  • Incomplete argument list

  • Error creating index directory

  • Error opening index metadata database

  • Error creating a Search::Indexer object

words( $prefix)

Returns an array reference containing words starting with $prefix

Arguments

  • $prefix - String - only words starting with $prefix will be returned

Returns - An array reference containing the words starting with $prefix

Exceptions - No full text index found

search(%named_arguments)

search for $search_string in the index database

Arguments %named_arguments

SEARCH_STRING - Query string see Search::Indexer

Returns - Array reference - each entry contains

  • SCORE - the score obtained by the file when applying the query

  • PATH - the path to the file

  • MD5 - the file MD5 when the indexing was done

match_description(%named_arguments)

search for documents which description matches a regular expression passed as argument. Documents without description never match.

Arguments %named_arguments

SEARCH_STRING - regular expression to match with the description field

Returns - Array reference - each entry contains

  • PATH - the path to the file

  • MD5 - the file MD5 when the indexing was done

  • DESCRIPTION - the file description

BUGS AND LIMITATIONS

None so far.

AUTHOR

        Nadim ibn hamouda el Khemir
        CPAN ID: NKH
        mailto: nadim@cpan.org

LICENSE AND COPYRIGHT

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

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Search::Indexer::Incremental::MD5

You can also look for information at:

SEE ALSO