/[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 68 - (show annotations)
Sun Jan 8 00:13:09 2006 UTC (18 years, 2 months ago) by dpavlin
File MIME type: text/plain
File size: 794 byte(s)
two simple examples included under synopsis in documentation
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 $node->set_url("http://localhost:1978/node/test");
15 $node->set_auth("admin","admin");
16
17 # create condition
18 my $cond = new Search::Estraier::Condition;
19
20 # set search phrase
21 $cond->set_phrase("rainbow AND lullaby");
22
23 my $nres = $node->search($cond, 0);
24 if (defined($nres)) {
25 # for each document in results
26 for my $i ( 0 ... $nres->doc_num - 1 ) {
27 # get result document
28 my $rdoc = $nres->get_doc($i);
29 # display attribte
30 print "URI: ", $rdoc->attr('@uri'),"\n";
31 print "Title: ", $rdoc->attr('@title'),"\n";
32 print $rdoc->snippet,"\n";
33 }
34 } else {
35 die "error: ", $node->status,"\n";
36 }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26