Lucy::Index::Lexicon - Iterator for a field’s terms.
my $lex_reader = $seg_reader->obtain('Lucy::Index::LexiconReader'); my $lexicon = $lex_reader->lexicon( field => 'content' ); while ( $lexicon->next ) { print $lexicon->get_term . "\n"; }
A Lexicon is an iterator which provides access to all the unique terms for a given field in sorted order.
If an index consists of two documents with a ‘content’ field holding “three blind mice” and “three musketeers” respectively, then iterating through the ‘content’ field’s lexicon would produce this list:
blind mice musketeers three
$lexicon->seek($target); $lexicon->seek(); # default: undef
Seek the Lexicon to the first iterator state which is greater than or equal to target
.
If target
is undef,
reset the iterator.
my $bool = $lexicon->next();
Proceed to the next term.
Returns: true until the iterator is exhausted, then false.
$lexicon->reset();
Reset the iterator. next() must be called to proceed to the first element.
my $obj = $lexicon->get_term();
Return the current term, or undef if the iterator is not in a valid state.
Lucy::Index::Lexicon isa Clownfish::Obj.
Copyright © 2010-2015 The Apache Software Foundation, Licensed under the
Apache License, Version 2.0.
Apache Lucy, Lucy, Apache, the Apache feather logo, and the Apache Lucy project logo are trademarks of The
Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their
respective owners.