Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

kinosearch1::search::hits(3pm) [debian man page]

KinoSearch1::Search::Hits(3pm)				User Contributed Perl Documentation			    KinoSearch1::Search::Hits(3pm)

NAME
KinoSearch1::Search::Hits - access search results SYNOPSIS
my $hits = $searcher->search( query => $query ); $hits->seek( 0, 10 ); while ( my $hashref = $hits->fetch_hit_hashref ) { print "<p>$hashref->{title} <em>$hashref->{score}</em></p> "; } DESCRIPTION
Hits objects are used to access the results of a search. By default, a hits object provides access to the top 100 matches; the seek() method provides finer-grained control. A classic application would be paging through hits. The first time, seek to a START of 0, and retrieve 10 documents. If the user wants to see more -- and there are more than 10 total hits -- seek to a START of 10, and retrieve 10 more documents. And so on. METHODS
seek $hits->seek( START, NUM_TO_RETRIEVE ); Position the Hits iterator at START, and capture NUM_TO_RETRIEVE docs. total_hits my $num_that_matched = $hits->total_hits; Return the total number of documents which matched the query used to produce the Hits object. (This number is unlikely to match NUM_TO_RETRIEVE.) fetch_hit while ( my $hit = $hits->fetch_hit ) { # ... } Return the next hit as a KinoSearch1::Search::Hit object. fetch_hit_hashref while ( my $hashref = $hits->fetch_hit_hashref ) { # ... } Return the next hit as a hashref, with the field names as keys and the field values as values. An entry for "score" will also be present, as will an entry for "excerpt" if create_excerpts() was called earlier. However, if the document contains stored fields named "score" or "excerpt", they will not be clobbered. create_excerpts my $highlighter = KinoSearch1::Highlight::Highlighter->new( excerpt_field => 'bodytext', ); $hits->create_excerpts( highlighter => $highlighter ); Use the supplied highlighter to generate excerpts. See KinoSearch1::Highlight::Highlighter. COPYRIGHT
Copyright 2005-2010 Marvin Humphrey LICENSE, DISCLAIMER, BUGS, etc. See KinoSearch1 version 1.00. perl v5.14.2 2011-11-15 KinoSearch1::Search::Hits(3pm)

Check Out this Related Man Page

KinoSearch1(3pm)					User Contributed Perl Documentation					  KinoSearch1(3pm)

NAME
KinoSearch1 - search engine library VERSION
1.00 STABLE FORK
KinoSearch1 is a fork of KinoSearch version 0.165 intended to provide stability and backwards compatibility. For the latest features, see the main branch. SYNOPSIS
First, write an application to build an inverted index, or "invindex", from your document collection. use KinoSearch1::InvIndexer; use KinoSearch1::Analysis::PolyAnalyzer; my $analyzer = KinoSearch1::Analysis::PolyAnalyzer->new( language => 'en' ); my $invindexer = KinoSearch1::InvIndexer->new( invindex => '/path/to/invindex', create => 1, analyzer => $analyzer, ); $invindexer->spec_field( name => 'title', boost => 3, ); $invindexer->spec_field( name => 'bodytext' ); while ( my ( $title, $bodytext ) = each %source_documents ) { my $doc = $invindexer->new_doc; $doc->set_value( title => $title ); $doc->set_value( bodytext => $bodytext ); $invindexer->add_doc($doc); } $invindexer->finish; Then, write a second application to search the invindex: use KinoSearch1::Searcher; use KinoSearch1::Analysis::PolyAnalyzer; my $analyzer = KinoSearch1::Analysis::PolyAnalyzer->new( language => 'en' ); my $searcher = KinoSearch1::Searcher->new( invindex => '/path/to/invindex', analyzer => $analyzer, ); my $hits = $searcher->search( query => "foo bar" ); while ( my $hit = $hits->fetch_hit_hashref ) { print "$hit->{title} "; } DESCRIPTION
KinoSearch1 is a loose port of the Java search engine library Apache Lucene, written in Perl and C. The archetypal application is website search, but it can be put to many different uses. Features o Extremely fast and scalable - can handle millions of documents o Incremental indexing (addition/deletion of documents to/from an existing index). o Full support for 12 Indo-European languages. o Support for boolean operators AND, OR, and AND NOT; parenthetical groupings, and prepended +plus and -minus o Algorithmic selection of relevant excerpts and highlighting of search terms within excerpts o Highly customizable query and indexing APIs o Phrase matching o Stemming o Stoplists Getting Started KinoSearch1 has many, many classes, but you only need to get aquainted with three to start with: o KinoSearch1::InvIndexer o KinoSearch1::Searcher o KinoSearch1::Analysis::PolyAnalyzer Probably the quickest way to get something up and running is to cut and paste the sample applications out of KinoSearch1::Docs::Tutorial and adapt them for your purposes. SEE ALSO
The actively developed main branch, KinoSearch. The KinoSearch homepage, where you'll find links to the mailing list and so on, is <http://www.rectangular.com/kinosearch>. The Lucene homepage is <http://lucene.apache.org>. KinoSearch1::Docs::FileFormat, for an overview of the invindex file format. History Search::Kinosearch 0.02x, no longer supported, is this suite's forerunner. Plucene is a pure-Perl port of Lucene 1.3. KinoSearch is a from-scratch project which attempts to draws on the lessons of both. The API is not compatible with either. KinoSearch is named for Kino, the main character in John Steinbeck's novella, "The Pearl". SUPPORT
Please direct support questions to the KinoSearch mailing list: subscription information at <http://www.rectangular.com/kinosearch>. BUGS
UTF-8 scalars are not indexed properly. This is fixed in KinoSearch 0.3x, but cannot be fixed in KinoSearch1 without breaking index compatibility with KinoSearch 0.165 from which KinoSearch1 was forked. Not thread-safe. Indexing crashes reliably on Solaris 2.9 or other systems which are fussy about pointer alignment. Please report any other bugs or feature requests to "bug-kinosearch1@rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=KinoSearch1>. COPYRIGHT &; LICENSE Copyright 2005-2010 Marvin Humphrey This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Terms of usage for Apache Lucene, from which portions of KinoSearch1 are derived, are spelled out in the Apache License: see the file "ApacheLicense2.0.txt". DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. perl v5.14.2 2011-11-15 KinoSearch1(3pm)
Man Page