mattweber / solr-for-wordpress

A WordPress plugin that replaces the default WordPress search with Solr
85 stars 36 forks source link

import related things (memory limit, encoding issues and stray ?> in admin panel) #28

Closed DavidGoodwin closed 12 years ago

DavidGoodwin commented 12 years ago
  1. Fix stray ?> in the admin options page.
  2. Reduce batch size and try and avoid memory limit problems when performing an import on a wordpress 3.1 blog (I'm not sure if the wp_cache_flush() is what solved it, or reducing the batch size from 1000 to 250). Regardless, the combination did work. I remain mystified as to why this server didn't accept me increasing the memory limit to 4gb (Which would have fixed the problem) and instead insisted on failing at 256mb .... nevermind.

Error seen : [01-Dec-2011 00:31:05] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 71 bytes) in /xxxxxx/httpdocs/wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/Document.php on line 179

  1. Fix/workaround dodgy data on import -

Error seen: [01-Dec-2011 00:48:38] PHP Warning: htmlspecialchars() [function.htmlspecialchars]: Invalid multibyte sequence in argument in /xxxxxx/httpdocs/wp-content/plugins/solr-for-wordpress/SolrPhpClient/Apache/Solr/Service.php on line 785

Passing data through utf8_encode() appears to solve the problem. It's possible this is a problem unique to this site; but this fixes it for me. Note, I'm stuck on PHP5.2.6 - newer versions of PHP/htmlspecialchars have additional options which would probably solve this, but I can't use.

thanks David.

dustinrue commented 12 years ago

I'm the one who tweaked the routine you also worked on and wp_cache_flush reduces memory usage the most. I never figured out how, where or why memory usage would creep up at times and wp_cache_flush would slow that considerably. Batch size didn't seem to do much other than slow down the entire process.

The typo would have also been my fault.

shaksi commented 12 years ago

I guess the reason I never get the memory exceed comment is i run drupal and we know what a memory hog it is and naturally i have it up quite high.

Hmm i thought i fixed that stray <? shrugs

Fair enough changes, thank you!

DavidGoodwin commented 12 years ago

I think it (memory limit) was set for 256m on the site I was having trouble with...

David

David Goodwin Pale Purple Ltd. http://www.palepurple.co.uk 0845 0046746 07792 380669

On 5 Dec 2011, at 19:14, Shakur Shidane reply@reply.github.com wrote:

heh yea i caught the typo a tad while back... I guess the reason I never get the memory exceed comment is i run drupal and we know what a memory it is and naturally i have it up quite high.


Reply to this email directly or view it on GitHub: https://github.com/mattweber/solr-for-wordpress/pull/28#issuecomment-3021496