Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void IndexWriter::close (  ) 

Flushes all changes to an index, closes all associated files, and closes the directory that the index is stored in.

Definition at line 161 of file IndexWriter.cpp.

References flushRamSegments().

Referenced by IndexModifier::close(), IndexModifier::createIndexReader(), and IndexModifier::flush().

                           {
  //Func - Flushes all changes to an index, closes all associated files, and closes
  //       the directory that the index is stored in.
  //Pre  - closeDir indicates if the directory must be closed or not
  //Post - All the changes have been flushed to disk and the write lock has been released
  //       The ramDirectory has also been closed. The directory has been closed
  //       if the reference count of the directory reaches zero

       SCOPED_LOCK_MUTEX(THIS_LOCK)
     if ( isOpen ){
         //Flush the Ram Segments
         flushRamSegments();
         //Close the ram directory
         if ( ramDirectory != NULL ){
              ramDirectory->close();
              _CLDECDELETE(ramDirectory);
         }

         //Check if this instance must close the directory
         if ( closeDir ){
               directory->close();
         }
         _CLDECDELETE(directory);

      // release write lock
         if (writeLock != NULL){
               writeLock->release();
               _CLDELETE( writeLock );
         }

       isOpen = false;
     }
  }


Generated by  Doxygen 1.6.0   Back to index