Assume that solr schema is : <div class="code"> <schema name="Members core" version="1.1"><types><fieldtype name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/></types><fields><!-- general --><field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/><field name="type" type="string" indexed="true" stored="true" multiValued="false"/><field name="name" type="string" indexed="true" stored="true" multiValued="false"/><field name="core1" type="string" indexed="true" stored="true" multiValued="false"/></fields><!-- field to use to determine and enforce document uniqueness. --><uniqueKey>id</uniqueKey><!-- field for the QueryParser to use when an explicit fieldname is absent --><defaultSearchField>name</defaultSearchField><!-- SolrQueryParser configuration: defaultOperator="AND|OR" --><solrQueryParser defaultOperator="OR"/></schema> </div> <ol> <? addTest('Check is class exists ?',class_exists('KoSolr'),true,true); $inst = KoSolr::getInstance(); addTest('Check is server available ? (NOT IMPLEMENTED)',$inst->getServer()->is_available(),true,true); $server = $inst->getServer(); // Same as $server = new KoSolr_Server('SOLR_SERVER',8080,'/apache-solr-3.5.0','CORENAME'); $server = new KoSolr_Server('solr',8080,'/apache-solr-3.5.0','members'); addTest('Check is server object ? ',($server instanceof KoSolr_Server),true,true); $server->execute($server->create_delete_request('*:*')); $server->commit(); $server->optimize(); addTest('Delete all items',true,true); $doc = new KoSolr_Document(); $doc->id = "id TEST"; $doc->name = 'xxx TEST'; // You can add more fields of schena : // $doc->some_field_name = 'xxx'.$i; addTest('Creating new documet',(!$doc),false,true); $update_request = $server->create_update_request(); addTest('Creating update request',(!$update_request),false,true);
/** * Execute request * @param KoSolr_Server_Request_Admin $request * @param int|bool $timeout * @return KoSolr_Server_Response_IExtend * @throws Exception */ public function execute(KoSolr_Server_Request_Admin $request, $timeout = FALSE) { return parent::execute($request, $timeout); }
/** * Executes on server */ public function execute() { $this->_server->execute($this); }