+//FIXME: size limit
+
+$es = new Elasticsearch($GLOBALS['phinde']['elasticsearch']);
+$existingDoc = $es->get($url);
+if ($existingDoc && $existingDoc->status == 'indexed') {
+ $nMoDate = strtotime($existingDoc->modate);
+ $refreshtime = $GLOBALS['phinde']['refreshtime'];
+ if (time() - $nMoDate < $refreshtime) {
+ echo "URL already indexed less than $refreshtime seconds ago: $url\n";
+ exit(0);
+ }
+
+ $req->setHeader('If-Modified-Since: ' . date('r', $nMoDate));
+}
+//FIXME: sourcetitle, sourcelink
+