division by zero in node_search

catch - June 25, 2008 - 12:00
Project:xapian
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Now xapian is indexing, and search is working, I'm getting a lot of division by zero errors in node_search:

This is the relevant bit of code:

  $results[] = array('link' => url('node/'. $item->sid, NULL, NULL, TRUE),
                           'type' => node_get_types('name', $node),
                           'title' => $node->title,
                           'user' => theme('username', $node),
                           'date' => $node->changed,
                           'node' => $node,
                           'extra' => $extra,
                           'score' => $item->score / $total,
                           'snippet' => search_excerpt($keys, $node->body));

Marking as active needs more info until I can track down steps to reproduce.

#1

Jeremy - July 8, 2008 - 13:54

When do you see these errors? Where do they show up? (In the watchdog log? On the screen?)

#2

catch - July 8, 2008 - 14:11
Status:postponed (maintainer needs more info)» active

Sorry, forgot to follow up on this one.

Errors are in watchdog.

The division by zero happens when all node scoring factors are set to 0 - so it just needs to check for that condition (ref: http://acquia.com/blog/drupals-search-compared-google-and-yahoo for how core handles this and why I did it in the first place).

#3

Jeremy - July 8, 2008 - 14:43

What is the complete error message?

#4

catch - July 8, 2008 - 14:53

Division by zero in modules/node/node.module on line 948.

#5

Jeremy - July 8, 2008 - 14:55

If you disable the xapian module, does the error go away? Offhand, it seems unlikely that the xapian module is responsible for the error you're seeing, as it's not using core's weighting methods.

#6

catch - July 8, 2008 - 15:11
Status:active» closed

Yep, same issue without xapian enabled. Sorry. Idiotic bug report.

#7

catch - July 8, 2008 - 15:12

Core bug here for reference: http://drupal.org/node/252580 Looks like it never made it into D5.

 
 

Drupal is a registered trademark of Dries Buytaert.