Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

plucene::index::writer(3pm) [debian man page]

Plucene::Index::Writer(3pm)				User Contributed Perl Documentation			       Plucene::Index::Writer(3pm)

NAME
Plucene::Index::Writer - write an index. SYNOPSIS
my $writer = Plucene::Index::Writer->new($path, $analyser, $create); $writer->add_document($doc); $writer->add_indexes(@dirs); $writer->optimize; # called before close my $doc_count = $writer->doc_count; my $mergefactor = $writer->mergefactor; $writer->set_mergefactor($value); DESCRIPTION
This is the writer class. If an index will not have more documents added for a while and optimal search performance is desired, then the "optimize" method should be called before the index is closed. METHODS
new my $writer = Plucene::Index::Writer->new($path, $analyser, $create); This will create a new Plucene::Index::Writer object. The third argument to the constructor determines whether a new index is created, or whether an existing index is opened for the addition of new documents. mergefactor / set_mergefactor my $mergefactor = $writer->mergefactor; $writer->set_mergefactor($value); Get / set the mergefactor. It defaults to 5. doc_count my $doc_count = $writer->doc_count; add_document $writer->add_document($doc); Adds a document to the index. After the document has been added, a merge takes place if there are more than $Plucene::Index::Writer::mergefactor segments in the index. This defaults to 10, but can be set to whatever value is optimal for your application. optimize $writer->optimize; Merges all segments together into a single segment, optimizing an index for search. This should be the last method called on an indexer, as it invalidates the writer object. add_indexes $writer->add_indexes(@dirs); Merges all segments from an array of indexes into this index. This may be used to parallelize batch indexing. A large document collection can be broken into sub-collections. Each sub-collection can be indexed in parallel, on a different thread, process or machine. The complete index can then be created by merging sub-collection indexes with this method. After this completes, the index is optimized. perl v5.12.4 2011-08-14 Plucene::Index::Writer(3pm)

Check Out this Related Man Page

Plucene::Index::Reader(3pm)				User Contributed Perl Documentation			       Plucene::Index::Reader(3pm)

NAME
Plucene::Index::Reader - Abstract class for accessing an index DESCRIPTION
IndexReader is an abstract class, providing an interface for accessing an index. Search of an index is done entirely through this abstract interface, so that any subclass which implements it is searchable. Concrete subclasses of IndexReader are usually constructed with a call to the static method "open". For efficiency, in this API documents are often referred to via document numbers, non-negative integers which each name a unique document in the index. These document numbers are ephemeral--they may change as documents are added to and deleted from an index. Clients should thus not rely on a given document having the same number between sessions. METHODS
new my $reader = Plucene::Index::Reader->new($dir_name); This will create a new Plucene::Index::Reader with the passed in directory. open # If there is only one segment my Plucene::Index::SegmentReader $seg_read = $reader->open; # If there are many segments my Plucene::Index::SegmentsReader $seg_read = $reader->open; Returns an IndexReader reading the index in the given Directory. last_modified my $last_modified = Plucene::Index::Reader->last_modified($directory); index_exists if (Plucene::Index::Reader->index_exists($directory)){ ... } is_locked if (Plucene::Index::Reader->is_locked($directory)){ ... } delete $reader->delete($doc); delete_term $reader->delete_term($term); This will delete all the documents which contain the passed term. close $reader->close; unlock $reader->unlock($directory); num_docs / max_doc / document / is_deleted / norms / terms / doc_freq / term_docs / term_positions / _do_delete / _do_close These must be defined in a subclass perl v5.12.4 2011-08-14 Plucene::Index::Reader(3pm)
Man Page