1<?php 2 3include "bootstrap.php"; 4 5$options = array 6( 7 'hostname' => SOLR_SERVER_HOSTNAME, 8 'login' => SOLR_SERVER_USERNAME, 9 'password' => SOLR_SERVER_PASSWORD, 10 'port' => SOLR_SERVER_PORT, 11 'path' => SOLR_SERVER_PATH, 12); 13 14$client = new SolrClient($options); 15 16$doc = new SolrInputDocument(); 17 18$doc->addField('id', 334455); 19$doc->addField('cat', 'Software'); 20$doc->addField('cat', 'Lucene'); 21 22// No need to call commit() because $commitWithin is passed, so Solr Server will auto commit within 10 seconds 23$updateResponse = $client->addDocument($doc, false, 10000); 24 25print_r($updateResponse->getResponse()); 26