lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kostali hassan <med.has.kost...@gmail.com>
Subject curl adapter in solarium 3x
Date Thu, 03 Dec 2015 10:50:19 GMT
How to force the connection to explicitly close when it has finished
processing, and not be pooled for reuse.
they are a way to tell to  server may send a keep-alive timeout (with
default Apache install, it is 15 seconds or 100 requests, whichever comes
first) - but cURL will just open another connection when that happens.

this is my function's cakephp to index rich data from files system


*App::import('Vendor','autoload',array('file'=>'solarium/vendor/autoload.php'));*

*public function indexDocument(){*
*$config = array(*
*         "endpoint" => array("localhost" => array("host"=>"127.0.0.1",*
*         "port"=>"8983", "path"=>"/solr", "core"=>"demo",)*
*        ) );*
*       $start = microtime(true);*

*if($_POST){*
*            // create a client instance*
*$client = new Solarium\Client($config);*
*$dossier=$this->request->data['User']['dossier'];*
*$dir = new Folder($dossier);*
*$files = $dir->find('.*\.*');*

* $headers = array('Content-Type:multipart/form-data');*

*foreach ($files as $file) {*
*    $file = new File($dir->pwd() . DS . $file);*

*$query = $client->createExtract();*
*$query->setFile($file->pwd());*
*$query->setCommit(true);*
*$query->setOmitHeader(false);*

*$doc = $query->createDocument();*
*$doc->id =$file->pwd();*
*$doc->name = $file->name;*
*$doc->title = $file->name();*

*$query->setDocument($doc);*

*$request = $client->createRequest($query);*
*$request->addHeaders($headers);*

*$result = $client->executeRequest($request);*
*}*

*}*

*$this->set(compact('start'));*
*}*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message