By default in Drupal 5 is not possible to change the number of results per page in search.

I've search in module search and in line 871 we can see:

$result = pager_query("SELECT * FROM temp_search_results", 10, 0, $count_query);

so it's true the number of results can be changed, it's always 10.

Is it possible to make the followings changes in the search.module (i don't know where to submit patches for search.module) ?

In line 871:

instead of:

<?php
$result
= pager_query("SELECT * FROM temp_search_results", 10, 0, $count_query);
?>

replaced by

<?php
$result
= pager_query("SELECT * FROM temp_search_results", variable_get('search_num_results',10), 0, $count_query);
?>

and in the function search_admin_settings insert:

<?php
  $form
['num_results'] = array('#type' => 'fieldset',
                  
'#title' => t('Number of results per page'));
 
$form['num_results']['search_num_results'] = array('#type' => 'textfield',
                       
'#title' => t('Results number'),
                       
'#default_value' => variable_get('search_num_results', 10),
                       
'#size' => 5,
                       
'#maxlength' => 3,
                       
'#description' => t('The number of results to show per page'));
?>

I don't know if it can be changed in Drupal 5 (i think is not possible) but is it possible for 6?

Comments

NancyDru’s picture

The powers-that-be will not accept feature requests for the current version, so no, this would not make D5. It may even be too late for D6. I agree that this seems to be an oversight. It should at least honor the post settings variable.

Post your feature requests in http://drupal.org/project/drupal.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

Carlitus’s picture

thanks :)

danieltome’s picture

There is an issue opened here: http://drupal.org/node/33809

Can this be considered for the next 5.x update?

It does feel "hackish" editing the search.module if you need to change your search results limit.
IMHO This should not be considered a feature request but it should be raised as an issue.

thanks and kind regards,

NancyDru’s picture

It is highly unlikely that you will see new features in 5.x, or even in 6.x. If you want a new feature in Drupal, you must go to the link above and post it where the core developers will see it. The development of 7.x is well along, so you'll need to hurry if you want any chance of even seeing it in 7.x. It would help if you could post a patch and help test it.

NancyDru (formerly Nancy W. until I got married to Drupal)