1Lucy::Index::Lexicon(3)User Contributed Perl DocumentatioLnucy::Index::Lexicon(3)
2
3
4
6 Lucy::Index::Lexicon - Iterator for a fieldXs terms.
7
9 my $lex_reader = $seg_reader->obtain('Lucy::Index::LexiconReader');
10 my $lexicon = $lex_reader->lexicon( field => 'content' );
11 while ( $lexicon->next ) {
12 print $lexicon->get_term . "\n";
13 }
14
16 A Lexicon is an iterator which provides access to all the unique terms
17 for a given field in sorted order.
18
19 If an index consists of two documents with a XcontentX field holding
20 Xthree blind miceX and Xthree musketeersX respectively, then iterating
21 through the XcontentX fieldXs lexicon would produce this list:
22
23 blind
24 mice
25 musketeers
26 three
27
29 seek
30 $lexicon->seek($target);
31 $lexicon->seek(); # default: undef
32
33 Seek the Lexicon to the first iterator state which is greater than or
34 equal to "target". If "target" is undef, reset the iterator.
35
36 next
37 my $bool = $lexicon->next();
38
39 Proceed to the next term.
40
41 Returns: true until the iterator is exhausted, then false.
42
43 reset
44 $lexicon->reset();
45
46 Reset the iterator. next() must be called to proceed to the first
47 element.
48
49 get_term
50 my $obj = $lexicon->get_term();
51
52 Return the current term, or undef if the iterator is not in a valid
53 state.
54
56 Lucy::Index::Lexicon isa Clownfish::Obj.
57
58
59
60perl v5.34.0 2022-01-21 Lucy::Index::Lexicon(3)