Paid affiliate advertisement

Bounty - $250 - Search not indexing content properly

cachilupi - November 17, 2007 - 18:06

Drupal Community,

I am in desperate need of some help here. Here's my situation:

I have a Drupal site running 4.7 which has been live for over a year. It is a financial industry website with over 10000 nodes representing stock fund reports. I recently had to move this site in a hurry from Site5 hosting because of serious downtime. (Don't get me started on Site5!) Anyway, I've moved this site to a new server with a different version of PHP (from 4.3 to 5.1.6). After only a few tweaks I had the site running and seemingly working perfectly.

Not until I moved the domain name to the new server and made the site live did I realize that my search wasn't indexing. Since the index was so huge, I chose not to copy the search rows from the DB and just re-index the site. But now that I'm trying to re-index I'm getting the strangest results.

  1. If I re-index the search, it tells me I have 10500 items to be indexed.
  2. When I run cron by visiting the cron.php page in the browser, it runs for a few seconds and returns the usual blank page.
  3. When I return to Search Settings, it tells me only 8000 items left to be indexed. That's right, it claims to have indexed 2500 items when it was set to index 100.
  4. Upon further investigation, I find that it is only indexing the 100 items. At least, that's all that is getting stored in the DB.
  5. So I run Cron again. This time it drops to 1200 remaining items, an amazing 7000 items supposedly indexed. Of course it's not indexing them, but I have no idea why it's doing this.

So here's what I've tried so far, following suggestions from the forums:

  • Remove / reinstall search module
  • Clear search tables in DB
  • Reconfigure search by changing minimum word length, keyword relevance, etc...

And none of these have helped at all. Still the same crazy results with the amount remaining.

So I'm offering a $250 bounty for anyone who will help me fix this. This is crucial that it gets done ASAP, so please respond quickly.

Thanks,
Chuck

I can fix your problem

papile - November 19, 2007 - 22:58

Hello,
I can help you. I have fixed this same exact problem for my company and another person on this forum. I am a professional Drupal programmer from NY. If you leave give me an email to contact you, we can work out how to get this done (IE giving me database access/or a dump.) here is my spam/public email address: specialp at gmail.com and if you contact me I will contact you from my professional email.

Thanks

cachilupi - November 20, 2007 - 19:08

Thanks to all those who have responded to my post. I was able to get this fixed with the help of Sign. Unfortunately, we were only able to find a way around the issue, rather than solving the issue directly. If anyone else has a similar problem, I feel for you and am willing to share my work-around, but it requires changes to node.module, so I'm not evangelizing it. :(

Thanks again,
Chuck
Cachilupi

chuck, could you please

SiliconMind - January 11, 2008 - 01:31

chuck, could you please share with me your workaround. it seems like i have exactly the same problem. may node.module is a bit modded anyway, so few more lines of code won't make the difference ;)

CHUCK....

kasperjames - January 15, 2008 - 07:47

I dont have your problem....

but I dont WANT your problem.
(hmm, sounds like an std or something...haha)

let me know what your contraceptive is. LOL

thanks,
kasperjames

Thanks for your help and support:
www.kasperjames.com/

I've had a few people ask

cachilupi - March 13, 2008 - 22:31

I've had a few people ask for the details on how we fixed this issue. Simply, we rewrote the DB query for search into a simple query, rather than the complex query that is in Drupal by default. Here it is...

Here are the changes that fixed the problem:

node.module

line 620 is commented original query and below is new query

//$remaining = db_result(db_query('SELECT COUNT(*) FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = 1 AND ((GREATEST(n.created, n.changed, c.last_comment_timestamp) = %d AND n.nid > %d ) OR (n.created > %d OR n.changed > %d OR c.last_comment_timestamp > %d))', $last, $last_nid, $last, $last, $last));

$remaining = db_result(db_query('SELECT COUNT(*) FROM {node} n WHERE n.nid > %d', $last_nid));
      return array('remaining' => $remaining, 'total' => $total);

line 2175

//$result = db_query_range('SELECT GREATEST(IF(c.last_comment_timestamp IS NULL, 0, c.last_comment_timestamp), n.changed) as last_change, n.nid FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE n.status = 1 AND ((GREATEST(n.changed, c.last_comment_timestamp) = %d AND n.nid > %d) OR (n.changed > %d OR c.last_comment_timestamp > %d)) ORDER BY GREATEST(n.changed, c.last_comment_timestamp) ASC, n.nid ASC', $last, $last_nid, $last, $last, $last, 0, $limit);

$result = db_query_range('SELECT n.nid, n.changed as last_change FROM {node} n WHERE n.nid > %d', $last_nid, 0, $limit);

 
 

Drupal is a registered trademark of Dries Buytaert.