1--TEST-- 2SolrClient::addDocument() - sending document to the Solr server 3--SKIPIF-- 4<?php 5include 'skip.if.server_not_configured.inc'; 6?> 7--FILE-- 8<?php 9 10require_once "bootstrap.inc"; 11 12$options = array 13( 14 'hostname' => SOLR_SERVER_HOSTNAME, 15 'login' => SOLR_SERVER_USERNAME, 16 'password' => SOLR_SERVER_PASSWORD, 17 'port' => SOLR_SERVER_PORT, 18 'path' => SOLR_SERVER_PATH, 19); 20 21$client = new SolrClient($options); 22 23$doc = new SolrInputDocument(); 24 25$doc->addField('id', 334455); 26$doc->addField('cat', 'Software'); 27$doc->addField('cat', 'Lucene'); 28 29$doc2 = new SolrInputDocument(); 30 31$doc2->addField('id', 12345); 32$doc->addField('cat', 'Category1'); 33$doc->addField('cat', 'Category2'); 34 35$updateResponse = $client->addDocument($doc, true, 500); 36$updateResponse = $client->addDocument($doc2, true, 500); 37 38print_r($updateResponse->getResponse()); 39 40?> 41--EXPECTF-- 42SolrObject Object 43( 44 [responseHeader] => SolrObject Object 45 ( 46 [status] => 0 47 [QTime] => %d 48 ) 49 50) 51