root/Swishetest/trunk/Swishetest.pm

Revision 1965, 1.6 kB (checked in by joshr, 11 months ago)

tabs replaced with spaces. We use ts=4 sw=4 in vi.

Line 
1 package Swishetest;
2
3 use 5.008001;
4 use strict;
5 use warnings;
6
7 require Exporter;
8
9 our @ISA = qw(Exporter);
10 our %EXPORT_TAGS = ( 'all' => [ qw( build_index do_search) ] );
11 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
12 our @EXPORT = qw( );
13
14 our $VERSION = '0.05';
15
16 use DoSearch;
17 use BuildIndex;
18 use Carp;
19
20 $SIG{__WARN__} = sub { Carp::carp $_[0] };
21 $SIG{__DIE__} = sub { Carp::confess $_[0] };
22
23
24 1;
25
26 __END__
27 =head1 NAME
28
29 Swishetest - Library routines for the Swishetest tool
30
31 =head1 SYNOPSIS
32
33   use Swishetest qw(build_index do_search);
34   use Data::Dumper qw(Dumper);
35    
36   my %info = build_index( "input/data", "out/myindex.index");
37     # 3rd & 4th params 'configfile' and 'extraoptions' are optional
38   print Dumper( \%info );
39   open_index("myindex.index");
40   my @rows = do_search( "myindex.index", "this is the search" );   
41         # returns a list of hashrefs
42   close_index("myindex.index");
43   print Dumper( \@rows );
44   #Test::More::comp_ok( scalar(@rows), '>', 10, "more than 10 results found");
45
46 =head1 DESCRIPTION
47
48 build_index() builds an index given a directory and a target index, and returns
49 some data about the index (from 'swish-e -v 1 ...') in a hash. It takes four parameters:
50
51  my %opts = build_index( $input_dir, $index, [$configfile], [$extraswisheoptions] );
52  my @r = do_search( $index, $query );
53
54 do_search() returns a list of hashrefs of the rows returned from the search.
55
56 =head2 EXPORT
57
58 None by default. 
59
60 =head1 AUTHOR
61
62 Josh Rabinowitz, E<lt>joshr@nonetE<gt>
63
64 =head1 COPYRIGHT AND LICENSE
65
66 Copyright 2004-2007 by Josh Rabinowitz
67
68 This library is free software; you can redistribute it and/or modify
69 it under the same terms as Perl itself.
70
71 =cut
Note: See TracBrowser for help on using the browser.