One of my members just submitted a rather long article to the forums and we ended up with lots of mysql errors of the form :-

Duplicate entry 'virtues' for key 1 query: INSERT INTO search_total (word, count) VALUES ('virtues', 0.136808331478) in /home/weplycom/public_html/porttalbotchat-co-uk/includes/database.mysql.inc on line 120.

Duplicate entry 'characterization' for key 1 query: INSERT INTO search_total (word, count) VALUES ('characterization', 0.1960537025) in /home/weplycom/public_html/porttalbotchat-co-uk/includes/database.mysql.inc on line 120.

Duplicate entry 'possess' for key 1 query: INSERT INTO search_total (word, count) VALUES ('possess', 0.218035614094) in /home/weplycom/public_html/porttalbotchat-co-uk/includes/database.mysql.inc on line 120.

And many more (around 20 or so repeated errors. It also showed on the frontpage and then disappeared.

We've experianced this a few times before as well but nothing that severe. Anyone any ideas what could be the cause ?

Comments

desm0n’s picture

Mmmm this just happened again for no reason. Again another list of duplicate entries found.

Any ideas ? Its getting rather frustrating.

desm0n’s picture

still happening from time to time. Anyone any reason why ?

Mr.Sollis’s picture

Have you found a solution? I looked at the table, there is no unique key column other then word... its trying to insert words into the table that already exist instead of updating them... if you found a patch, let me know !

Thanks!

kmillecam’s picture

Fresh install 4.7.2
It appears to happen when the cron runs and tries to update the search indexes.

What contributed modules are the rest of you running?
Here's my list:

buddylist
countdown
glossary
invite
nodevote
nodewords
notify
poormanscron
print
privatemsg
tagadelic
userpoints

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.

desm0n’s picture

I wonder if its poormanscron.

I also rfun privatemsg, notify and buddylist on your list. I doubt its notify or buddylist so that possibly narrows it down.

I don't always have the problem but it does happen from time to time and causes a printed MYSQL and is very frustrating. Doesn't seem to effect the search index or indeed the site but obvkiously i would prefer not having to see it.

billk2’s picture

I'm getting the same error and I'm using curl with a proper cron set up. From then after cron.php fails to complete and the site stops getting indexed.

It seems like it could be the root of a problem I'm having with my search index. Any help would be appreciated.

Bill /<.

widhalmt’s picture

I use cron from a different machine. Any solution to this by now?

kmillecam’s picture

We're still having this problem.

Do any of you developers who might be following this thread have any suggested tests we can run or more info we can provide.

I'm happy to do any legwork necessary to pinpoint the problem.

Thanks,
Kevin

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.

NickHBO’s picture

Do no Drupal developers check this forum? It would be great to get a resolution to this issue, I'm having it as well. I only share poormanscron with the list desm0n supplied in a reply above. Every cron run that involves indexing produces these errors for me, it has happened since I first started populating my site with content.

Will a Drupal dev please give a helping hand in this matter.

Nick

kmillecam’s picture

It appears on our site that the errors occur when a user hits the site and triggers poorman's cron.

Still a mystery to me.

I've posted an issue against Poorman's Cron to see if someone over there will look into it: http://drupal.org/node/85171

Kevin

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.

wwwoliondorcom’s picture

Hi,

I got this problem and wonder if you have found a solution ?

Thanks for help.

MatthijsG’s picture

Me to.

Seems very quiet here ...

======
There are 10 people who can count binary
They who can and they who don't

erantone’s picture

You should have the following code (HACK) in the CORE (modules/search/search.module). This is critical issue.


function search_update_totals() {
  // Update word IDF (Inverse Document Frequency) counts for new/changed words
  foreach (search_dirty() as $word => $dummy) {
    // Get total count
    $total = db_result(db_query("SELECT SUM(score) FROM {search_index} WHERE word = '%s'", $word));
    //// === hack, custom by eric START
    $exist = db_result(db_query("SELECT COUNT(word) FROM {search_total} WHERE word = '%s'", $word));
    if (!empty($total) && $exist) {
      // Apply Zipf's law to equalize the probability distribution
      $total = log10(1 + 1/(max(1, $total)));
      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);
      //}
    } else {
      db_query("INSERT INTO {search_total} (word, count) VALUES ('%s', %f)", $word, $total);
    }
    //// ==== hack, custom by eric END
</em>
  }
  // Find words that were deleted from search_index, but are still in
  // search_total. We use a LEFT JOIN between the two tables and keep only the
  // rows which fail to join.
  $result = db_query("SELECT t.word AS realword, i.word FROM {search_total} t LEFT JOIN {search_index} i ON t.word = i.word WHERE i.word IS NULL");
  while ($word = db_fetch_object($result)) {
    db_query("DELETE FROM {search_total} WHERE word = '%s'", $word->realword);
  }
}

erantone’s picture

That code should go on Drupal 6