Commit e018e407 authored by asajedi's avatar asajedi
Browse files

Merge branch 'excludeSampleTEIDocumentFromIndexing' into 'master'

Prevent the sample TEI file from being included to productive files

See merge request !60
parents 903c0141 003aa4cb
Pipeline #255762 failed with stages
in 9 minutes and 54 seconds
......@@ -44,7 +44,7 @@ class SolrIndexing extends Command
$output->writeln('Start solr indexing.');
$this->importer->import($server);
$this->indexer->deleteSolrIndex();
$this->indexer->tei2solr();
$this->indexer->tei2solr($server);
$time = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
$time /= 60;
$output->writeln('Indexing process completed in '.$time.' minutes.');
......
......@@ -125,19 +125,21 @@ class Indexer implements IndexerInterface
$this->teiSampleDir = $teiSampleDir;
}
public function tei2solr(): void
public function tei2solr(string $server): void
{
$this->client->getEndpoint()->setOptions(['timeout' => 60, 'index_timeout' => 60]);
$finder = new Finder();
$finder->files()->in($this->teiDir);
// ===========================================================
// Append a sample file which is useful during development.
// Remove for production
$finderSample = new Finder();
$finderSample->files()->in($this->teiSampleDir);
$finder->append($finderSample);
// ===========================================================
if ('dev' === $server) {
// ===========================================================
// Append a sample file which is useful during development.
// Remove for production
$finderSample = new Finder();
$finderSample->files()->in($this->teiSampleDir);
$finder->append($finderSample);
// ===========================================================
}
foreach ($finder as $file) {
libxml_use_internal_errors(true);
......
......@@ -10,5 +10,5 @@ interface IndexerInterface
public function getTextVersions(string $filePath, array $graphics = []): SolrDocument;
public function tei2solr(): void;
public function tei2solr(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