Here are a workaround of this issue: On line 382 of SolrPhpClient/Apache/Solr/Service.php, I change to:
while(true){ $str = file_get_contents($url, false, $this->_postContext); if(empty($str) == false){ break; } } $response = new Apache_Solr_Response($str, $http_response_header, $this->_createDocuments, $this->_collapseSingleValueArrays); As I found that, for some strange reason on Windows, when you post some data and add index, Solr may not be able to receive it. Therefore I added an infinitive loop and if it does not receive any response ($str is empty), we post it again. Side effect: when I open the window console to see it, sometimes it will prompt: Failed to open stream: HTTP request failed! I haven't researched it yet, but the index is built successfully. Hope it helps someone. Ellery Leung wrote: > > Hi Israel > > Thank you for your response. > > However, I use both ini_set and set the _defaultTimeout to 6000 but the > error still occur with same error message. > > Now, when I start build the index, the error pops up much faster than > changing it before. > > So do you have any idea? > > Thank you in advance for your help. > > > > > Israel Ekpo wrote: >> >> Ellery, >> >> A preliminary look at the source code indicates that the error is >> happening >> because the solr server is taking longer than expected to respond to the >> client >> >> http://code.google.com/p/solr-php-client/source/browse/trunk/Apache/Solr/Service.php >> >> The default time out handed down to Apache_Solr_Service:_sendRawPost() is >> 60 >> seconds since you were calling the addDocument() method >> >> So if it took longer than that (1 minute), then it will exit with that >> error >> message. >> >> You will have to increase the default value to something very high like >> 10 >> minutes or so on line 252 in the source code since there is no way to >> specify that in the constructor or the addDocument method. >> >> Another alternative will be to update the default_socket_timeout in the >> php.ini file or in the code using ini_set >> >> I hope that helps >> >> >> >> On Tue, Jan 12, 2010 at 9:33 PM, Ellery Leung <elleryle...@be-o.com> >> wrote: >> >>> >>> Hi, here is the stack trace: >>> >>> <br /> >>> Fatal error: Uncaught exception 'Exception' with message '"0" >>> Status: Communication Error' in >>> C:\nginx\html\lib\SolrPhpClient\Apache\Solr\Serv >>> ice.php:385 >>> Stack trace: >>> #0 C:\nginx\html\lib\SolrPhpClient\Apache\Solr\Service.php(652): >>> Apache_Solr_Ser >>> vice->_sendRawPost('http://127.0.0....', '<add allowDups=...') >>> #1 C:\nginx\html\lib\SolrPhpClient\Apache\Solr\Service.php(676): >>> Apache_Solr_Ser >>> vice->add('<add allowDups=...') >>> #2 >>> >>> C:\nginx\html\apps\milio\lib\System\classes\SolrSearchEngine.class.php(221): >>> Apache_Solr_Service->addDocument(Object(Apache_Solr_Document)) >>> #3 >>> >>> C:\nginx\html\apps\milio\lib\System\classes\SolrSearchEngine.class.php(262): >>> SolrSearchEngine->buildIndex(Array, 'key') >>> #4 >>> C:\nginx\html\apps\milio\lib\System\classes\Indexer\Indexer.class.php(51): >>> So >>> lrSearchEngine->createFullIndex('contacts', Array, 'key', 'www') >>> #5 C:\nginx\html\apps\milio\lib\System\functions\createIndex.php(64): >>> Indexer-&g >>> t;create('www') >>> #6 {main} >>> thrown in C:\nginx\html\lib\SolrPhpClient\Apache\Solr\Service.php on li >>> ne 385<br /> >>> >>> C:\nginx\html\apps\milio\htdocs\Contacts>pause >>> Press any key to continue . . . >>> >>> Thanks for helping me. >>> >>> >>> Grant Ingersoll-6 wrote: >>> > >>> > Do you have a stack trace? >>> > >>> > On Jan 12, 2010, at 2:54 AM, Ellery Leung wrote: >>> > >>> >> When I am building the index for around 20000 ~ 25000 records, >>> sometimes >>> >> I >>> >> came across with this error: >>> >> >>> >> >>> >> >>> >> Uncaught exception "Exception" with message '0' Status: Communication >>> >> Error >>> >> >>> >> >>> >> >>> >> I search Google & Yahoo but no answer. >>> >> >>> >> >>> >> >>> >> I am now committing document to solr on every 10 records fetched from >>> a >>> >> SQLite Database with PHP 5.3. >>> >> >>> >> >>> >> >>> >> Platform: Windows 7 Home >>> >> >>> >> Web server: Nginx >>> >> >>> >> Solr Specification Version: 1.4.0 >>> >> >>> >> Solr Implementation Version: 1.4.0 833479 - grantingersoll - >>> 2009-11-06 >>> >> 12:33:40 >>> >> >>> >> Lucene Specification Version: 2.9.1 >>> >> >>> >> Lucene Implementation Version: 2.9.1 832363 - 2009-11-03 04:37:25 >>> >> >>> >> Solr hosted in jetty 6.1.3 >>> >> >>> >> >>> >> >>> >> All the above are in one single test machine. >>> >> >>> >> >>> >> >>> >> The situation is that sometimes when I build the index, it can be >>> created >>> >> successfully. But sometimes it will just stop with the above error. >>> >> >>> >> >>> >> >>> >> Any clue? Please help. >>> >> >>> >> >>> >> >>> >> Thank you in advance. >>> >> >>> > >>> > >>> > >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/What-is-this-error-means--tp27123815p27138658.html >>> Sent from the Solr - User mailing list archive at Nabble.com. >>> >>> >> >> >> -- >> "Good Enough" is not good enough. >> To give anything less than your best is to sacrifice the gift. >> Quality First. Measure Twice. Cut Once. >> http://www.israelekpo.com/ >> >> > > -- View this message in context: http://old.nabble.com/What-is-this-error-means--tp27123815p27156058.html Sent from the Solr - User mailing list archive at Nabble.com.