1Lucy::Search::IndexSearUcsheerr(C3o)ntributed Perl DocumLeunctya:t:iSoenarch::IndexSearcher(3)
2
3
4
6 Lucy::Search::IndexSearcher - Execute searches against a single index.
7
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
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
27 new
28 my $searcher = Lucy::Search::IndexSearcher->new(
29 index => '/path/to/index'
30 );
31
32 Create a new IndexSearcher.
33
34 · index - Either a string filepath, a Folder, or an IndexReader.
35
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
54 · field - Field name.
55
56 · term - 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
66 · query - A Query.
67
68 · collector - 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
75 · doc_id - A document id.
76
77 get_reader
78 my $index_reader = $index_searcher->get_reader();
79
80 Accessor for the objectXs "reader" member.
81
83 Lucy::Search::IndexSearcher isa Lucy::Search::Searcher isa
84 Clownfish::Obj.
85
86
87
88perl v5.28.1 2019-02-02 Lucy::Search::IndexSearcher(3)