KinoSe...h::Hits(3pm)
πΈ NAME πΈ
KinoSearch1::Search::Hits β bestie, this is how you actually get at your search results π it's like the backstage pass to everything your query turned up.
β¨ 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>\n";
}
π¦ DESCRIPTION π¦
okay so Hits objects are literally the way you access the results of a search, no cap. by default a hits object hands you the top 100 matches β like, that's the standard vibe β and if you want finer-grained control over which slice of results you're looking at, that's exactly what the seek() method is for π
the classic application here? paging through hits π the first time around, you 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 β you seek to a START of 10 and retrieve 10 more documents. and so on, and so on, forever and ever, iconic behavior honestly π
π METHODS π
π seek
$hits->seek( START, NUM_TO_RETRIEVE );
positions the Hits iterator at START, and captures NUM_TO_RETRIEVE docs. that's it, that's the whole job, she's simple and she delivers π«Ά
π total_hits
my $num_that_matched = $hits->total_hits;
returns the total number of documents that matched the query used to produce the Hits object. heads up bestie: this number is unlikely to match NUM_TO_RETRIEVE π like they're just different things, don't come for me.
π fetch_hit
while ( my $hit = $hits->fetch_hit ) {
# ...
}
returns the next hit as a KinoSearch1::Search::Hit object. one at a time, like a lil snack πΈ
π fetch_hit_hashref
while ( my $hashref = $hits->fetch_hit_hashref ) {
# ...
}
returns 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, and so will an entry for "excerpt" β but only if create_excerpts() was called earlier. and here's the lil plot twist: if the document itself contains stored fields named "score" or "excerpt", those will not be clobbered. your data stays your data, periodt β¨
π create_excerpts
my $highlighter = KinoSearch1::Highlight::Highlighter->new(
excerpt_field => 'bodytext',
);
$hits->create_excerpts( highlighter => $highlighter );
uses the supplied highlighter to generate excerpts. go peek at KinoSearch1::Highlight::Highlighter for the whole story π
π COPYRIGHT π
Copyright 2005-2010 Marvin Humphrey
π LICENSE, DISCLAIMER, BUGS, etc. π
See KinoSearch1 version 1.01.
and that's the whole page, bestie!! this lil doc came to you courtesy of perl v5.42.3, dated 2026-08-20, living under the manual name KinoSe...h::Hits(3pm) in the User Contributed Perl Documentation section π mwah, go forth and paginate your hits π§β
π¦ where this page comes from
- ubuntu stonking: libkinosearch1-perl 1.01-6build2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms