1Lucy::Search::IndexSearUcsheerr(C3opnmt)ributed Perl DocLuumceyn:t:aSteiaornch::IndexSearcher(3pm)
2
3
4

NAME

6       Lucy::Search::IndexSearcher - Execute searches against a single index.
7

SYNOPSIS

9           my $searcher = Lucy::Search::IndexSearcher->new(
10               index => '/path/to/index'
11           );
12           my $hits = $searcher->hits(
13               query      => 'foo bar',
14               offset     => 0,
15               num_wanted => 100,
16           );
17

DESCRIPTION

19       Use the IndexSearcher class to perform search queries against an index.
20       (For searching multiple indexes at once, see PolySearcher).
21
22       IndexSearchers operate against a single point-in-time view or Snapshot
23       of the index.  If an index is modified, a new IndexSearcher must be
24       opened to access the changes.
25

CONSTRUCTORS

27   new
28           my $searcher = Lucy::Search::IndexSearcher->new(
29               index => '/path/to/index'
30           );
31
32       Create a new IndexSearcher.
33
34index - Either a string filepath, a Folder, or an IndexReader.
35

METHODS

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

INHERITANCE

83       Lucy::Search::IndexSearcher isa Lucy::Search::Searcher isa
84       Clownfish::Obj.
85
86
87
88perl v5.38.0                      2023-07-20  Lucy::Search::IndexSearcher(3pm)
Impressum