2 //index repositories in elasticsearch
5 require_once __DIR__ . '/../src/phorkie/autoload.php';
6 require_once __DIR__ . '/../data/config.default.php';
7 if (file_exists(__DIR__ . '/../data/config.php')) {
8 require_once __DIR__ . '/../data/config.php';
10 if ($GLOBALS['phorkie']['cfg']['setupcheck']) {
17 if ($db->prefix == '\phorkie\Database_Adapter_Null') {
18 echo "Error: No search adapter configured.\n";
22 $idx = $db->getIndexer();
26 $db->getSetup()->reset();
29 $rs = new Repositories();
30 list($repos, $count) = $rs->getList(0, 10000);
31 foreach ($repos as $repo) {
32 echo 'Indexing ' . $repo->id . "\n";
33 $commits = $repo->getHistory();
34 $first = count($commits)-1;
35 $idx->addRepo($repo, $commits[$first]->committerTime, $commits[0]->committerTime);