Commit 903c0141 authored by asajedi's avatar asajedi
Browse files

Merge branch 'excludeSampleTEIDocumentFromIndexing' into 'master'

Exclude sample TEI document from indexing

See merge request !59
parents 41cb6479 02032ed7
Pipeline #255752 failed with stages
in 6 minutes and 49 seconds
......@@ -7,11 +7,13 @@ namespace App\Command;
use App\Import\ImporterInterface;
use App\Index\IndexerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SolrIndexing extends Command
{
protected static string $description = 'Process TEI data to solr data for importing into solr.';
protected static $defaultName = 'app:start_indexing';
private ImporterInterface $importer;
private IndexerInterface $indexer;
......@@ -28,7 +30,9 @@ class SolrIndexing extends Command
*/
protected function configure()
{
$this->setDescription('Process TEI data to solr data for importing into solr.');
$this
->setDescription(self::$description)
->addArgument('server', InputArgument::REQUIRED, 'Server Type');;
}
/**
......@@ -36,12 +40,11 @@ class SolrIndexing extends Command
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$server = $input->getArgument('server');
$output->writeln('Start solr indexing.');
$this->importer->import();
$this->importer->import($server);
$this->indexer->deleteSolrIndex();
$this->indexer->tei2solr();
$time = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
$time /= 60;
$output->writeln('Indexing process completed in '.$time.' minutes.');
......
......@@ -85,9 +85,12 @@ class Importer implements ImporterInterface
}
}
public function import(): void
public function import(string $server): void
{
$this->importSampleTeiDocument();
if ('dev' === $server) {
$this->importSampleTeiDocument();
}
$filesystem = new Filesystem();
if (!$filesystem->exists($this->teiDir)) {
$filesystem->mkdir($this->teiDir);
......
......@@ -4,5 +4,5 @@ namespace App\Import;
interface ImporterInterface
{
public function import(): void;
public function import(string $server): void;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment