| 1 |
###################################################################### |
| 2 |
Perldoc::Search 0.01 |
| 3 |
###################################################################### |
| 4 |
|
| 5 |
NAME |
| 6 |
Perldoc::Search - Index and Search local Perl Documentation |
| 7 |
|
| 8 |
SYNOPSIS |
| 9 |
####################################### |
| 10 |
# Command line utility: |
| 11 |
####################################### |
| 12 |
# This is permanent and needs to be performed only once |
| 13 |
# (or if new documentation gets installed). |
| 14 |
$ perldig -u |
| 15 |
|
| 16 |
# Then, search: |
| 17 |
$ perldig log AND apache AND connect |
| 18 |
1) CGI/Carp.pm 2) CGI/Prototype.pm |
| 19 |
3) DBI/Changes.pm 4) DBI/Changes.pm |
| 20 |
Enter number of choice: |
| 21 |
|
| 22 |
####################################### |
| 23 |
# API |
| 24 |
####################################### |
| 25 |
use Perldoc::Search; |
| 26 |
|
| 27 |
my $searcher = Perldoc::Search->new(); |
| 28 |
|
| 29 |
# This is permanent and needs to be performed only once |
| 30 |
# (or if new documentation gets installed). |
| 31 |
$searcher->update(); |
| 32 |
|
| 33 |
# Then, search: |
| 34 |
for my $hit ($searcher->search("log AND apache")) { |
| 35 |
print $hit->path(), "\n"; |
| 36 |
} |
| 37 |
|
| 38 |
DESCRIPTION |
| 39 |
"Perldoc::Search" uses the swish-e engine to index the local Perl |
| 40 |
documentation. It provides both the command line utility "perldig" and |
| 41 |
an API to perform searches on the index. It uses "SWISH::API::Common" as |
| 42 |
the indexing and search engine. |
| 43 |
|
| 44 |
Most likely, you will want the command line utility "perldig", please |
| 45 |
check the documentation that comes with it by calling |
| 46 |
|
| 47 |
perldoc perldig |
| 48 |
|
| 49 |
In case you're interested in the API, read on. |
| 50 |
|
| 51 |
METHODS |
| 52 |
"my $searcher = Perldoc::Search-$<gt"new()> |
| 53 |
Instantiates a searcher object. Usually takes no parameters. |
| 54 |
|
| 55 |
If you like to modify the searched directories or want to pass |
| 56 |
different options to "SWISH::API::Common", go ahead: |
| 57 |
|
| 58 |
use Config; |
| 59 |
|
| 60 |
my $searcher = Perldoc::Search->new( |
| 61 |
dirs => [$Config{installsitearch}, |
| 62 |
$Config{installsitelib}, |
| 63 |
$Config{installarchlib}, |
| 64 |
$Config{installprivlib}, |
| 65 |
], |
| 66 |
swish_options => { |
| 67 |
swish_adm_dir => "$ENV{HOME}/.perldig", |
| 68 |
} |
| 69 |
); |
| 70 |
|
| 71 |
"$searcher-"update()> |
| 72 |
Update the index. This operation might take a couple of minutes. |
| 73 |
|
| 74 |
"my @hits = $searcher-"search("log AND apache")> |
| 75 |
Perform a search on the index with the given query. Returns a list |
| 76 |
of result objects. |
| 77 |
|
| 78 |
# Search documents containing |
| 79 |
# both "foo" and "bar" |
| 80 |
for my $hit ($swish->search("foo AND bar")) { |
| 81 |
print $hit->path(), "\n"; |
| 82 |
} |
| 83 |
|
| 84 |
LEGALESE |
| 85 |
Copyright 2005 by Mike Schilli, all rights reserved. This program is |
| 86 |
free software, you can redistribute it and/or modify it under the same |
| 87 |
terms as Perl itself. |
| 88 |
|
| 89 |
AUTHOR |
| 90 |
2005, Mike Schilli <[email protected]> |
| 91 |
|