Hi people,

Recently, I've been getting this type of error in my Drupal 5.7 site, after entering new articles:

Duplicate entry 'some_term' for key 1 query: search_update_totals INSERT INTO search_total (word, count) VALUES ('some_term', 0.30102999566398) in /www/mysite/includes/database.mysql.inc in line 172.

The database table being affected appears to be only search_total.

For a series of about 30 new articles, each about 1 A4 page, I'm getting something like 50 of this type of errors. I notice that the indexed articles are searchable, and that the "some_terms" are searchable too. So, at first sight, nothing much appears to be going wrong. Still, I don't like this type of thing...

Questions:
1. is this bad?
2. how is it caused?
3. does something require fixing?
4. if so, HOW ???

I have access to the MySQL database through PHPMyAdmin, but I don't have root access to the servers.

Thanks for all your help!

Comments

alan d.’s picture

I found this issue that may explain what is happening. http://drupal.org/node/218403 The functionality is fairly similar in both D5 and D6.


Alan Davison
www.caignwebs.com.au

Alan Davison
modul’s picture

Thanks for your reply, Alan D, but the thread you're referring to does not seem to apply to what I have. In your thread, the main problem causing double entries has to do with accented and unaccented versions of "the same word". That is not the case here. Furthermore, your thread describes problems in search_index, my stuff refers to search_totals.

My terms causing duplicate entries are not instances of accented or unaccented words, they're very neutral words, nothing special, no special characters to be seen.

So, I'm still wondering: where does my problem come from? And more especially: is there something I should fix, and if yes, where and how???

alan d.’s picture

Hi modul

From the search of the D5.7 code, you'll find:

<?php
    db_query("UPDATE {search_total} SET count = %f WHERE word = '%s'", $total, $word);
    if (!db_affected_rows()) {
      db_query("INSERT INTO {search_total} (word, count) VALUES ('%s', %f)", $word, $total);
    }
?>

This appears to be the only insert for search_total, so suggesting that there are some issues with the way Drupal is inserting the terms that allow the conflict, as per the thread.

Alternatively, the sql index from this table may be corrupt, run any table repair tools that you can find with phpmyadmin, or uninstall and reinstall the search module. This should drop the tables and then reinstall them. The site will need to be re-indexed again.

The only thing that this table does is to weight the search results, so nothing major. Still I hate any errors showing too.

Personally, I'd a backup, disable search, uninstall search, then reinstall the module and forcing the reindex by manually running cron a number of times.

Good luck.


Alan Davison
www.caignwebs.com.au

Alan Davison
modul’s picture

Thanks very much for your reply, Alan. Your explanation has at least indicated where I should start looking and fixing. I'm a little more at ease now. Errors shouldn't be there, and if they are, the message should contain at least some hint of a solution. Hel-loooo MySQL/PHP...
Thanks! I appreciate your effort and your time!

modul’s picture

Hi all, I'm still wondering about these duplicate entry errors: how bad are they? What does it actually mean? What can I do to prevent them? And what to correct them???

inforeto’s picture

subscribing.

(got similar error on multisite, cron re-updating same db)

keesje’s picture

I have a site affected by duplicate's in the search index too.

For what its worth, Ubercart.org is afected by this too...

drupal 5.9.

Anyone?

Kees

erantone’s picture