NAME
KinoSearch::Search::Hits - access search results
SYNOPSIS
my $hits = $searcher->search($query);
$hits->seek(0, 10);
my $total_hits = $hits->total_hits;
while ( my $hit = $hits->fetch_hit_hashref ) {
print "$hit->{title}\n";
}
DESCRIPTION
Hits objects are used to access the results of a search.
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.
seek must be called before anything else.
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_hashref
while ( my $hit = $hits->fetch_hit_hashref ) {
# ...
}
# or...
while ( my ( $hit, $score ) = $hits->fetch_hit_hashref ) {
# ...
}
Return the next hit or hit/score pairing. The hit is retrieved as a hashref, with the field names as keys and the field values as values. In list context, fetch_hit_hashref returns the hashref and a floating point score.
COPYRIGHT
Copyright 2005-2006 Marvin Humphrey
LICENSE, DISCLAIMER, BUGS, etc.
See KinoSearch version 0.05_03.