Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Import_all_data_to_solr
<?php
/**
* Ingest script to import all the data in the complete directory into solr
*/
include('ingest.php');
class Import_all_data_to_solr {
public $ingest;
public function __construct()
{
$this->ingest = new Ingest();
$this->search_dir();
}
private function search_dir()
{
$rii = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('complete'));
foreach ($rii as $file) {
if ($file->isDir()){
continue;
}
echo($file->getPathname()) . "\n";
$this->sendToSolr($file->getPathname());
}
}
/**
* Solr ingest
* @param string $file [description]
*/
private function sendToSolr($file)
{
$this->ingest->getData($file);
}
}
(new Import_all_data_to_solr());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment