| 1 | package SWISH::Prog::Xapian; | ||
| 2 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 2 | our $VERSION = '0.09'; | |
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | SWISH::Prog::Xapian - Swish3 Xapian backend | ||
| 10 | |||
| 11 | =head1 SYNOPSIS | ||
| 12 | |||
| 13 | # create an indexing program | ||
| 14 | use SWISH::Prog; | ||
| 15 | my $indexer = SWISH::Prog->new( | ||
| 16 | invindex => 'path/to/index.swish', | ||
| 17 | aggregator => 'fs', | ||
| 18 | indexer => 'xapian', | ||
| 19 | config => 'path/to/swish.conf', | ||
| 20 | ); | ||
| 21 | |||
| 22 | $indexer->index('path/to/files'); | ||
| 23 | |||
| 24 | # then search the index | ||
| 25 | my $searcher = SWISH::Prog::Xapian::Searcher->new( | ||
| 26 | invindex => 'path/to/index.swish', | ||
| 27 | config => 'path/to/swish.conf', | ||
| 28 | ); | ||
| 29 | my $results = $searcher->search('my query') | ||
| 30 | while ( my $result = $results->next ) { | ||
| 31 | printf("%s : %s\n", $result->score, $result->uri); | ||
| 32 | } | ||
| 33 | |||
| 34 | =head1 DESCRIPTION | ||
| 35 | |||
| 36 | B<STOP>: Read the L<SWISH::Prog> documentation before you use this | ||
| 37 | module. | ||
| 38 | |||
| 39 | SWISH::Prog::Xapian is a Xapian-based implementation of Swish3, | ||
| 40 | using the SWISH::3 bindings for libswish3. | ||
| 41 | |||
| 42 | See the Swish3 development site at http://dev.swish-e.org/wiki/swish3 | ||
| 43 | |||
| 44 | =head1 Why Not Use Search::Xapian Directly? | ||
| 45 | |||
| 46 | You can use Search::Xapian directly. Using Search::Xapian via SWISH::Prog::Xapian | ||
| 47 | offers a few advantages: | ||
| 48 | |||
| 49 | =over | ||
| 50 | |||
| 51 | =item Aggregators and Filters | ||
| 52 | |||
| 53 | You get to use all of SWISH::Prog's Aggregators and SWISH::Filter support. | ||
| 54 | So you can easily index all kinds of file formats | ||
| 55 | (email, .txt, .html, .xml, .pdf, .doc, .xls, etc) | ||
| 56 | without writing your own parser. | ||
| 57 | |||
| 58 | =item SWISH::3 | ||
| 59 | |||
| 60 | SWISH::3 offers fast and robust XML and HTML parsers | ||
| 61 | with an extensible configuration system, build on top of libxml2. | ||
| 62 | |||
| 63 | =item Simple now, complex later | ||
| 64 | |||
| 65 | You can index your content with SWISH::Prog::Xapian, | ||
| 66 | then build a more complex searching application directly | ||
| 67 | with Search::Xapian. | ||
| 68 | |||
| 69 | =item Compatibility with swish_xapian | ||
| 70 | |||
| 71 | The C<swish_xapian> tool that comes as part of libswish3 should | ||
| 72 | generate compatible indexes. So you can create indexes with | ||
| 73 | SWISH::Prog::Xapian::Indexer and search them with C<swish_xapian> | ||
| 74 | and vice versa. | ||
| 75 | |||
| 76 | =back | ||
| 77 | |||
| 78 | =head1 AUTHOR | ||
| 79 | |||
| 80 | Peter Karman, C<< <karman at cpan dot org> >> | ||
| 81 | |||
| 82 | =head1 BUGS | ||
| 83 | |||
| 84 | Please report any bugs or feature requests to | ||
| 85 | C<bug-swish-prog-xapian at rt.cpan.org>, or through the web interface at | ||
| 86 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SWISH-Prog-Xapian>. | ||
| 87 | I will be notified, and then you'll automatically be notified of progress on | ||
| 88 | your bug as I make changes. | ||
| 89 | |||
| 90 | =head1 SUPPORT | ||
| 91 | |||
| 92 | You can find documentation for this module with the perldoc command. | ||
| 93 | |||
| 94 | perldoc SWISH::Prog::Xapian | ||
| 95 | |||
| 96 | You can also look for information at: | ||
| 97 | |||
| 98 | =over 4 | ||
| 99 | |||
| 100 | =item * Mailing list | ||
| 101 | |||
| 102 | L<http://lists.swish-e.org/listinfo/users> | ||
| 103 | |||
| 104 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 105 | |||
| 106 | L<http://annocpan.org/dist/SWISH-Prog-Xapian> | ||
| 107 | |||
| 108 | =item * CPAN Ratings | ||
| 109 | |||
| 110 | L<http://cpanratings.perl.org/d/SWISH-Prog-Xapian> | ||
| 111 | |||
| 112 | =item * RT: CPAN's request tracker | ||
| 113 | |||
| 114 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=SWISH-Prog-Xapian> | ||
| 115 | |||
| 116 | =item * Search CPAN | ||
| 117 | |||
| 118 | L<http://search.cpan.org/dist/SWISH-Prog-Xapian> | ||
| 119 | |||
| 120 | =back | ||
| 121 | |||
| 122 | =head1 COPYRIGHT & LICENSE | ||
| 123 | |||
| 124 | Copyright 2009 Peter Karman, all rights reserved. | ||
| 125 | |||
| 126 | This program is free software; you can redistribute it and/or modify it | ||
| 127 | under the same terms as Perl itself. | ||
| 128 | |||
| 129 | =head1 SEE ALSO | ||
| 130 | |||
| 131 | L<SWISH::Prog>, L<Search::Xapian> | ||
| 132 | |||
| 133 | =cut | ||
| 134 | |||
| 135 | 2 | 1; | |