1KinoSearch1::Search::HiUtsse(r3)Contributed Perl DocumenKtiantoiSoenarch1::Search::Hits(3)
2
3
4

NAME

6       KinoSearch1::Search::Hits - access search results
7

SYNOPSIS

9           my $hits = $searcher->search( query => $query );
10           $hits->seek( 0, 10 );
11           while ( my $hashref = $hits->fetch_hit_hashref ) {
12               print "<p>$hashref->{title} <em>$hashref->{score}</em></p>\n";
13           }
14

DESCRIPTION

16       Hits objects are used to access the results of a search.  By default, a
17       hits object provides access to the top 100 matches; the seek() method
18       provides finer-grained control.
19
20       A classic application would be paging through hits.  The first time,
21       seek to a START of 0, and retrieve 10 documents.  If the user wants to
22       see more -- and there are more than 10 total hits -- seek to a START of
23       10, and retrieve 10 more documents.  And so on.
24

METHODS

26   seek
27           $hits->seek( START, NUM_TO_RETRIEVE );
28
29       Position the Hits iterator at START, and capture NUM_TO_RETRIEVE docs.
30
31   total_hits
32           my $num_that_matched = $hits->total_hits;
33
34       Return the total number of documents which matched the query used to
35       produce the Hits object.  (This number is unlikely to match
36       NUM_TO_RETRIEVE.)
37
38   fetch_hit
39           while ( my $hit = $hits->fetch_hit ) {
40               # ...
41           }
42
43       Return the next hit as a KinoSearch1::Search::Hit object.
44
45   fetch_hit_hashref
46           while ( my $hashref = $hits->fetch_hit_hashref ) {
47               # ...
48           }
49
50       Return the next hit as a hashref, with the field names as keys and the
51       field values as values.  An entry for "score" will also be present, as
52       will an entry for "excerpt" if create_excerpts() was called earlier.
53       However, if the document contains stored fields named "score" or
54       "excerpt", they will not be clobbered.
55
56   create_excerpts
57           my $highlighter = KinoSearch1::Highlight::Highlighter->new(
58               excerpt_field => 'bodytext',
59           );
60           $hits->create_excerpts( highlighter => $highlighter );
61
62       Use the supplied highlighter to generate excerpts.  See
63       KinoSearch1::Highlight::Highlighter.
64
66       Copyright 2005-2010 Marvin Humphrey
67

LICENSE, DISCLAIMER, BUGS, etc.

69       See KinoSearch1 version 1.01.
70
71
72
73perl v5.34.0                      2022-01-21      KinoSearch1::Search::Hits(3)
Impressum