NAME
KinoSearch::Search::Hits - Access search results.
SYNOPSIS
my $hits = $searcher->search(
query => $query,
offset => 0,
num_wanted => 10,
);
while ( my $hashref = $hits->fetch_hit_hashref ) {
print "<p>$hashref->{title} <em>$hashref->{score}</em></p>\n";
}
DESCRIPTION
Hits objects are iterators used to access the results of a search.
METHODS
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. Note that this is the total number of matches, not just the number collected, and thus will rarely match NUM_WANTED
.
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 excerpts
if create_excerpts() was called earlier.
create_excerpts
my $highlighter = KinoSearch::Highlight::Highlighter->new;
$highlighter->add_spec( field => 'body' );
$hits->create_excerpts( highlighter => $highlighter );
Use the supplied highlighter to generate excerpts. See KinoSearch::Highlight::Highlighter.
COPYRIGHT
Copyright 2005-2007 Marvin Humphrey
LICENSE, DISCLAIMER, BUGS, etc.
See KinoSearch version 0.20.