1. Go to this page and download the library: Download minhd/solr-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// autocommit enabled to commit after every add
$doc = new SolrDocument;
$doc->id = 2;
$doc->title_s = "Second Document";
$doc->description_s = "Some description";
$client->add($doc);
// delete by id field
$client->remove(2);
// delete by query
$client->removeByQuery('id:2');
// search for all documents that has a subject field match aquatic, by 10 at a time
$search = [
'q' => 'subject:aquatic'
];
while($payload->getNextCursorMark() != $payload->getCursorMark()) {
$payload = $client->cursor($payload->getNextCursorMark(), 10, $search);
print_r($payload);
}
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.