$se = $papi->enumerateSyncedEntries('http://example.com/', PushAPI::RECURSIVE_DOCUMENTS); foreach ($se as $url => $stamp) { echo "Entry: url='" . $url . "' stamp='" . $stamp . "'\n"; } echo "Waiting for checkpoint serial " . $serial . "\n"; echo "Triggering indexing job\n"; $papi->triggerIndexingJob(); tickSet('checkpoint+trigger'); echo "Waiting for documents to be searchable ..\n"; while (!$papi->areDocumentsSearchable($serial)) { echo "Waiting .. current checkpoint: " . $papi->getCheckpoint() . " " . "\r"; sleep(3); } tickSet('indexing'); /* Update a document */ $docUpdate = new Document(array('uri' => 'http://example.com/doc2.html', 'metas' => array('title' => 'Bye bye!'))); $resp = $papi->updateDocument($docUpdate, array('title')); $serial = $papi->setCheckpoint(0, true); $papi->triggerIndexingJob(); while (!$papi->areDocumentsSearchable($serial)) { echo "Waiting .. current checkpoint: " . $papi->getCheckpoint() . " " . "\r"; sleep(3); } tickSet('updating'); $papi->ping(); $papi->close(); echo "All done!\n"; tickShow(); } catch (PushAPIFactory $e) { echo "Error: " . $e->getMessage() . "\n"; }
$papi->deleteDocumentRootPath('Skyrock', true); tickSet('cleanup'); /* 1,000,000 docs */ $prod = new MyDocProducer(1000); $prod->startBatch(); for ($k = 0; $k < 10; $k++) { echo '[' . $k . "] Producing 1,000 docs\n"; $papi->addDocumentList($prod); $prod->nextBatch(); } $prod->endBatch(); tickSet('processing of 1,000,000 docs'); tickShow(); echo "Set checkpoint\n"; $serial = $papi->setCheckpoint(0, true); echo "Waiting for checkpoint serial " . $serial . "\n"; echo "Triggering indexing job\n"; $papi->triggerIndexingJob(); tickSet('checkpoint+trigger of 1000 docs'); echo "Waiting for documents to be searchable ..\n"; while (!$papi->areDocumentsSearchable($serial)) { echo "Waiting .. current checkpoint: " . $papi->getCheckpoint() . " " . "\r"; sleep(3); } tickSet('indexing'); $papi->close(); echo "All done!\n"; tickShow(); } catch (PushAPIFactory $e) { echo "Error: " . $e->getMessage() . "\n"; }