1Lucy::Search::Searcher(U3s)er Contributed Perl DocumentatLiuocny::Search::Searcher(3)
2
3
4

NAME

6       Lucy::Search::Searcher - Base class for searching collections of
7       documents.
8

SYNOPSIS

10           # Abstract base class.
11

DESCRIPTION

13       Abstract base class for objects which search.  Core subclasses include
14       IndexSearcher and PolySearcher.
15

CONSTRUCTORS

17   new
18           package MySearcher;
19           use base qw( Lucy::Search::Searcher );
20           sub new {
21               my $self = shift->SUPER::new;
22               ...
23               return $self;
24           }
25
26       Abstract constructor.
27
28schema - A Schema.
29

ABSTRACT METHODS

31   doc_max
32           my $int = $searcher->doc_max();
33
34       Return the maximum number of docs in the collection represented by the
35       Searcher, which is also the highest possible internal doc id.
36       Documents which have been marked as deleted but not yet purged are
37       included in this count.
38
39   doc_freq
40           my $int = $searcher->doc_freq(
41               field => $field,  # required
42               term  => $term,   # required
43           );
44
45       Return the number of documents which contain the term in the given
46       field.
47
48field - Field name.
49
50term - The term to look up.
51
52   collect
53           $searcher->collect(
54               query     => $query,      # required
55               collector => $collector,  # required
56           );
57
58       Iterate over hits, feeding them into a Collector.
59
60query - A Query.
61
62collector - A Collector.
63
64   fetch_doc
65           my $hit_doc = $searcher->fetch_doc($doc_id);
66
67       Retrieve a document.  Throws an error if the doc id is out of range.
68
69doc_id - A document id.
70

METHODS

72   glean_query
73           my $query = $searcher->glean_query($query);
74           my $query = $searcher->glean_query();  # default: undef
75
76       If the supplied object is a Query, return it; if itXs a query string,
77       create a QueryParser and parse it to produce a query against all
78       indexed fields.
79
80   hits
81           my $hits = $searcher->hits(
82               query      => $query,       # required
83               offset     => $offset,      # default: 0
84               num_wanted => $num_wanted,  # default: 10
85               sort_spec  => $sort_spec,   # default: undef
86           );
87
88       Return a Hits object containing the top results.
89
90query - Either a Query object or a query string.
91
92offset - The number of most-relevant hits to discard, typically
93           used when XpagingX through hits N at a time.  Setting "offset" to
94           20 and "num_wanted" to 10 retrieves hits 21-30, assuming that 30
95           hits can be found.
96
97num_wanted - The number of hits you would like to see after
98           "offset" is taken into account.
99
100sort_spec - A SortSpec, which will affect how results are ranked
101           and returned.
102
103   get_schema
104           my $schema = $searcher->get_schema();
105
106       Accessor for the objectXs "schema" member.
107

INHERITANCE

109       Lucy::Search::Searcher isa Clownfish::Obj.
110
111
112
113perl v5.36.0                      2022-07-22         Lucy::Search::Searcher(3)
Impressum