File: idx_and_search.pl

package info (click to toggle)
libswish-api-common-perl 0.04-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 164 kB
  • sloc: perl: 229; makefile: 2
file content (27 lines) | stat: -rwxr-xr-x 606 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl -w
####################################################
# idx_and_search.pl - SWISH::API::Common test script
# Mike Schilli, 2005 (m@perlmeister.com)
####################################################
use strict;
use Log::Log4perl qw(:easy);

Log::Log4perl->easy_init($ERROR);

use SWISH::API::Common;

    # Generate index
my $sw = SWISH::API::Common->new();
$sw->index("/tmp");

    # Search for "michael"
my @results = $sw->search("michael");

    # Print results
if(@results) {
    for my $hit (@results) {
        print $hit->path(), "\n";
    }
} else {
    print "No results\n";
}