1KinoSearch1(3) User Contributed Perl Documentation KinoSearch1(3)
2
3
4
6 KinoSearch1 - search engine library
7
9 1.01
10
12 KinoSearch1 is a fork of KinoSearch version 0.165 intended to provide
13 stability and backwards compatibility. For the latest features, see
14 the main branch.
15
17 First, write an application to build an inverted index, or "invindex",
18 from your document collection.
19
20 use KinoSearch1::InvIndexer;
21 use KinoSearch1::Analysis::PolyAnalyzer;
22
23 my $analyzer
24 = KinoSearch1::Analysis::PolyAnalyzer->new( language => 'en' );
25
26 my $invindexer = KinoSearch1::InvIndexer->new(
27 invindex => '/path/to/invindex',
28 create => 1,
29 analyzer => $analyzer,
30 );
31
32 $invindexer->spec_field(
33 name => 'title',
34 boost => 3,
35 );
36 $invindexer->spec_field( name => 'bodytext' );
37
38 while ( my ( $title, $bodytext ) = each %source_documents ) {
39 my $doc = $invindexer->new_doc;
40
41 $doc->set_value( title => $title );
42 $doc->set_value( bodytext => $bodytext );
43
44 $invindexer->add_doc($doc);
45 }
46
47 $invindexer->finish;
48
49 Then, write a second application to search the invindex:
50
51 use KinoSearch1::Searcher;
52 use KinoSearch1::Analysis::PolyAnalyzer;
53
54 my $analyzer
55 = KinoSearch1::Analysis::PolyAnalyzer->new( language => 'en' );
56
57 my $searcher = KinoSearch1::Searcher->new(
58 invindex => '/path/to/invindex',
59 analyzer => $analyzer,
60 );
61
62 my $hits = $searcher->search( query => "foo bar" );
63 while ( my $hit = $hits->fetch_hit_hashref ) {
64 print "$hit->{title}\n";
65 }
66
68 KinoSearch1 is a loose port of the Java search engine library Apache
69 Lucene, written in Perl and C. The archetypal application is website
70 search, but it can be put to many different uses.
71
72 Features
73 • Extremely fast and scalable - can handle millions of documents
74
75 • Incremental indexing (addition/deletion of documents to/from an
76 existing index).
77
78 • Full support for 12 Indo-European languages.
79
80 • Support for boolean operators AND, OR, and AND NOT; parenthetical
81 groupings, and prepended +plus and -minus
82
83 • Algorithmic selection of relevant excerpts and highlighting of
84 search terms within excerpts
85
86 • Highly customizable query and indexing APIs
87
88 • Phrase matching
89
90 • Stemming
91
92 • Stoplists
93
94 Getting Started
95 KinoSearch1 has many, many classes, but you only need to get aquainted
96 with three to start with:
97
98 • KinoSearch1::InvIndexer
99
100 • KinoSearch1::Searcher
101
102 • KinoSearch1::Analysis::PolyAnalyzer
103
104 Probably the quickest way to get something up and running is to cut and
105 paste the sample applications out of KinoSearch1::Docs::Tutorial and
106 adapt them for your purposes.
107
109 The actively developed main branch, KinoSearch.
110
111 The KinoSearch homepage, where you'll find links to the mailing list
112 and so on, is <http://www.rectangular.com/kinosearch>.
113
114 The Lucene homepage is <http://lucene.apache.org>.
115
116 KinoSearch1::Docs::FileFormat, for an overview of the invindex file
117 format.
118
120 Search::Kinosearch 0.02x, no longer supported, is this suite's
121 forerunner. Plucene is a pure-Perl port of Lucene 1.3. KinoSearch is a
122 from-scratch project which attempts to draws on the lessons of both.
123 The API is not compatible with either.
124
125 KinoSearch is named for Kino, the main character in John Steinbeck's
126 novella, "The Pearl".
127
129 Please direct support questions to the KinoSearch mailing list:
130 subscription information at <http://www.rectangular.com/kinosearch>.
131
133 UTF-8 scalars are not indexed properly. This is fixed in KinoSearch
134 0.3x, but cannot be fixed in KinoSearch1 without breaking index
135 compatibility with KinoSearch 0.165 from which KinoSearch1 was forked.
136
137 Not thread-safe.
138
139 Indexing crashes reliably on Solaris 2.9 or other systems which are
140 fussy about pointer alignment.
141
142 Please report any other bugs or feature requests to
143 "bug-kinosearch1@rt.cpan.org", or through the web interface at
144 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=KinoSearch1>.
145
147 Copyright 2005-2010 Marvin Humphrey
148
149 This program is free software; you can redistribute it and/or modify it
150 under the same terms as Perl itself.
151
152 Terms of usage for Apache Lucene, from which portions of KinoSearch1
153 are derived, are spelled out in the Apache License: see the file
154 "ApacheLicense2.0.txt".
155
157 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
158 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
159 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
160 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
161 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
162 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
163 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
164 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
165 NECESSARY SERVICING, REPAIR, OR CORRECTION.
166
167 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
168 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
169 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
170 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
171 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
172 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
173 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
174 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
175 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
176 DAMAGES.
177
178
179
180perl v5.34.0 2022-01-21 KinoSearch1(3)