A cron run results in a host of these errors.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near
'301029995664 WHERE word = 'leslie''
at line 1 query:
UPDATE search_total SET count = 0,301029995664 WHERE word = 'leslie' i /web/www.mysite.com/www/modules/search/search.module on line 288.

The line in question is a part of function search_update_totals() and reads

    db_query("UPDATE {search_total} SET count = %f WHERE word = '%s'", $total, $word);
<code>

where $total is

<code>
$total = db_result(db_query("SELECT SUM(score) FROM {search_index} WHERE word = '%s'", $word));
    // Apply Zipf's law to equalize the probability distribution
    $total = log10(1 + 1/(max(1, $total)));

$total is, apparently, a number.

Comments

damien tournoud’s picture

Status: Active » Postponed (maintainer needs more info)

Please find out if a module in your installation is calling set_locale().

MauMau’s picture

A node (content type: page) is calling
setlocale(LC_ALL, 'danish');
to display a date.

So yes, set_locale is run.

MauMau’s picture

I wondered what was being written to search_total.
So I put
$$watchdog('SearchDebug', $word . ' ' . $total);
just before line 288.

Starting out everything is fine and dandy in the dblog:

SearchDebug	12/08/2009 - 16:15	useful 0.17185396007
SearchDebug	12/08/2009 - 16:15	justintime 0.301029995664
SearchDebug	12/08/2009 - 16:15	learning 0.0045608513597	
SearchDebug	12/08/2009 - 16:15	global 0.00403011211257	
SearchDebug	12/08/2009 - 16:15	development 0.0111916375704	

Then suddendly it goes awry. Drupal tries to write to search_total but gets an error:

SearchDebug	12/08/2009 - 16:21	together 0,0328391802093
php	12/08/2009 - 16:21	You have an error in your SQL syntax; check the ...
SearchDebug	12/08/2009 - 16:21	lovely 0,291670411892	Skriv dit navn	
php	12/08/2009 - 16:21	You have an error in your SQL syntax; check the ...	
SearchDebug	12/08/2009 - 16:21	enjoyed 0,30102999566
php	12/08/2009 - 16:21	You have an error in your SQL syntax; check the ...	
SearchDebug	12/08/2009 - 16:21	talked 0,0793717198173

The error will typically look like:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#039;301029995664 WHERE word = &#039;enjoyed&#039;&#039; at line 1 query:
UPDATE search_total SET count = 0,301029995664 WHERE word = &#039;enjoyed&#039; i /web/www.mysite.com/www/modules/search/search.module på linje 289.

So, what do we know?
$total is 0,301029995664
$word is enjoyed
the line in question reads:
db_query("UPDATE {search_total} SET count = %f WHERE word = '%s'", $total, $word);

Maybe the error hasn't got much to do with the oddly placed '

MauMau’s picture

Status: Postponed (maintainer needs more info) » Active

Could &helllip;

&helllip;

be the culprit?

The behaviour of search is this:

It runs fine and indexes correctly.
80% through the php-errors turn up, the mismatched '.
At 92% everything gets stuck and Search provokes an immediate cron timeout.

It's rather hard to find out at which node it get's stuck. But maybe … and set_locale is bringing some strange Search module error to light?

MySQl is 5.0.67, PHP is 5.2.6, Apache s 1.3.41 (Unix)

MauMau’s picture

Assigned: Unassigned » MauMau
Status: Active » Closed (fixed)

Taking a clue from
http://chirale.wordpress.com/2009/07/10/cron-cannot-run-on-drupal-the-dr...
I removed the one node containing a drupal_goto

And voila! Everything indexed well.

The Search-module apparently has an inability to parse drupal_goto's correctly.

There is a quickfix at
http://drupal.org/node/102138#comment-1688632

And a good discussion by competent people at
http://drupal.org/node/286263

I'm closing this one.