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.

Comments

jeremy’s picture

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

catch’s picture

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).

jeremy’s picture

What is the complete error message?

catch’s picture

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

jeremy’s picture

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.

catch’s picture

Status: Active » Closed (fixed)

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

catch’s picture

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