public function updateIndex()
    {
        $this->startLogging();
        $this->addLog('Indexing start.');
        $this->addLog('Clearing index.');
        $this->resetIndex();
        $this->addLog('Cleaning Published Deleted Documents');
        $this->storage->getDocuments()->cleanPublishedDeletedDocuments();
        $this->addLog('Retrieving documents to be indexed.');
        $documents = $this->storage->getDocuments()->getPublishedDocumentsNoFolders();
        $this->addLog('Start Document Term Count for ' . count($documents) . ' documents');
        $this->createDocumentTermCount($documents);
        $this->addLog('Start Document Term Frequency.');
        $this->createDocumentTermFrequency();
        $this->addLog('Start Term Field Length Norm.');
        $this->createTermFieldLengthNorm();
        $this->addLog('Start Inverse Document Frequency.');
        $this->createInverseDocumentFrequency();
        $this->addLog('Replacing old index.');
        $this->replaceOldIndex();
        $this->addLog('Indexing complete.');
        return $this->log;
    }