/[Search-Estraier]/trunk/scripts/example_searcher.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/scripts/example_searcher.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102 - (show annotations)
Sat Jan 28 19:46:20 2006 UTC (18 years, 2 months ago) by dpavlin
File MIME type: text/plain
File size: 859 byte(s)
more documentation update
1 #!/usr/bin/perl -w
2
3 use strict;
4 use Search::Estraier;
5
6 =head1 NAME
7
8 example_searcher.pl - example searcher for Search::Estraier
9
10 =cut
11
12 # create and configure node
13 my $node = new Search::Estraier::Node(
14 url => 'http://localhost:1978/node/test',
15 user => 'admin',
16 passwd => 'admin',
17 croak_on_error => 1,
18 );
19
20 # create condition
21 my $cond = new Search::Estraier::Condition;
22
23 # set search phrase
24 $cond->set_phrase("rainbow AND lullaby");
25
26 my $nres = $node->search($cond, 0);
27
28 if (defined($nres)) {
29 print "Got ", $nres->hits, " results\n";
30
31 # for each document in results
32 for my $i ( 0 ... $nres->doc_num - 1 ) {
33 # get result document
34 my $rdoc = $nres->get_doc($i);
35 # display attribte
36 print "URI: ", $rdoc->attr('@uri'),"\n";
37 print "Title: ", $rdoc->attr('@title'),"\n";
38 print $rdoc->snippet,"\n";
39 }
40 } else {
41 die "error: ", $node->status,"\n";
42 }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26