--- xapian.module.orig	2008-06-01 12:38:47.000000000 -0400
+++ xapian.module	2008-06-01 12:38:59.000000000 -0400
@@ -164,7 +164,7 @@
     '#title' => t('Database port'),
     '#default_value' => variable_get('xapian_database_port', '6431'),
     '#required' => ($database_type == 1),
-    '#validate' => ($database_type == 1) ? array('_xapian_validate_port' => array('xapian_database_port')) : array(),
+    '#validate' => array('_xapian_validate_port' => array('xapian_database_port')),
     '#description' => t('Remote port that xapian-tcpsrv is listening on.'),
   );
 
@@ -195,7 +195,6 @@
     '#description' => t('The maximum number of items that will be indexed in one cron run.  Set this number lower if your cron is timing out or if PHP is running out of memory.'),
     '#options' => $items,
     '#default_value' => variable_get('xapian_indexing_throttle', 100),
-    '#validate' => array('_xapian_validate_positive_integer' => array('xapian_indexing_throttle')),
   );
 
   // Display settings
@@ -258,11 +257,8 @@
  * @param string $field_name
  */
 function _xapian_validate_port($field, $field_name) {
-  if (is_numeric($field['#value']) && (int)$field['#value'] > 0 && (int)$field['#value'] < 65536) {
-    return;
-  }
-  else {
-    form_set_error($field_name, t('The value for "%field" must be a valid port.', array('%field' => $field['#title'])));
+  if (!is_numeric($field['#value']) || (int)$field['#value'] < 1 || (int)$field['#value'] > 65535) {
+    form_set_error($field_name, t('%value is not a valid port.', array('%value' => $field['#value'])));
   }
 }
 
@@ -273,11 +269,8 @@
  * @param string $field_name
  */
 function _xapian_validate_positive_integer($field, $field_name) {
-  if (is_numeric($field['#value']) && ((int)$field['#value'] == $field['#value']) && ((int)$field['#value'] > 0)) {
-    return;
-  }
-  else {
-    form_set_error($field_name, t('The value for "%field" must be a positive integer.', array('%field' => $field['#title'])));
+  if (!is_numeric($field['#value']) || (int)$field['#value'] < 0) {
+    form_set_error($field_name, t('"%value" is an invalid number of search results per page.', array('%value' => $field['#value'])));
   }
 }
 
