Use commit timestamps for ElasticSearch and sort on last commit time.
[phorkie.git] / scripts / index.php
index 4b529d1c7ee10b54997405f96c29fa5a02604145..5da912e2aa9750faceaa004c20841cb5847feceb 100644 (file)
@@ -37,6 +37,8 @@ $rs = new Repositories();
 list($repos, $count) = $rs->getList(0, 10000);
 foreach ($repos as $repo) {
     echo 'Indexing ' . $repo->id . "\n";
-    $idx->addRepo($repo, filectime($repo->gitDir));
+    $commits = $repo->getHistory();
+    $first = count($commits)-1;
+    $idx->addRepo($repo, $commits[$first]->committerTime, $commits[0]->committerTime);
 }
 ?>