TeamTNT\TNTSearch\Indexer\TNTIndexer::run PHP Method

run() public method

public run ( )
    public function run()
    {
        if ($this->config['driver'] == "filesystem") {
            return $this->readDocumentsFromFileSystem();
        }
        $result = $this->dbh->query($this->query);
        $counter = 0;
        $this->index->beginTransaction();
        while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
            $counter++;
            $this->processDocument(new Collection($row));
            if ($counter % $this->steps == 0) {
                $this->info("Processed {$counter} rows");
            }
            if ($counter % 10000 == 0) {
                $this->index->commit();
                $this->index->beginTransaction();
                $this->info("Commited");
            }
        }
        $this->index->commit();
        $this->updateInfoTable('total_documents', $counter);
        $this->info("Total rows {$counter}");
    }