CLucene - a full-featured, c++ search engine
API Documentation


lucene::index::SegmentMerger Class Reference

The SegmentMerger class combines two or more Segments, represented by an IndexReader (add, into a single Segment. More...

#include <SegmentMerger.h>

Inheritance diagram for lucene::index::SegmentMerger:

lucene::debug::LuceneBase

List of all members.

Public Member Functions

 SegmentMerger (IndexWriter *writer, const char *name)
 ~SegmentMerger ()
void add (IndexReader *reader)
 Add an IndexReader to the collection of readers that are to be merged.
IndexReadersegmentReader (const int32_t i)
int32_t merge ()
 Merges the readers specified by the add method into the directory passed to the constructor.
void closeReaders ()
 close all IndexReaders that have been added.

Friends

class IndexWriter


Detailed Description

The SegmentMerger class combines two or more Segments, represented by an IndexReader (add, into a single Segment.

After adding the appropriate readers, call the merge method to combine the segments.

If the compoundFile flag is set, then the segments will be merged into a compound file.

See also:
merge

add


Constructor & Destructor Documentation

lucene::index::SegmentMerger::SegmentMerger ( IndexWriter writer,
const char *  name 
)

Parameters:
dir The Directory to merge the other segments into
name The name of the new segment
compoundFile true if the new segment should use a compoundFile

lucene::index::SegmentMerger::~SegmentMerger (  ) 


Member Function Documentation

void lucene::index::SegmentMerger::add ( IndexReader reader  ) 

Add an IndexReader to the collection of readers that are to be merged.

Parameters:
reader 

void lucene::index::SegmentMerger::closeReaders (  ) 

close all IndexReaders that have been added.

Should not be called before merge().

Exceptions:
IOException 

int32_t lucene::index::SegmentMerger::merge (  ) 

Merges the readers specified by the add method into the directory passed to the constructor.

Returns:
The number of documents that were merged
Exceptions:
IOException 

IndexReader* lucene::index::SegmentMerger::segmentReader ( const int32_t  i  ) 

Parameters:
i The index of the reader to return
Returns:
The ith reader to be merged


Friends And Related Function Documentation

friend class IndexWriter [friend]


The documentation for this class was generated from the following file:

clucene.sourceforge.net