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?

In line 871:

instead of:

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

replaced by

$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:

  $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

robertdouglass’s picture

Version: 6.x-dev » 7.x-dev
Category: feature » bug

Bug.

dww’s picture

Category: bug » feature
Status: Active » Closed (duplicate)

This isn't a bug, and it's duplicate. ;)
#33809: Make pagers not suck

colan’s picture

Wouldn't it be more of a duplicate of #702940: Configure the number of search results per page?

dww’s picture

@colan: No: we always use the oldest issue for something. #702940 should be duplicate with #33809.

-otto-’s picture

Hi,

I've been looking into this because I needed to show 12 results on a page in a 4 by 3 grid. To my surprise this was not a setting in the search configuration.

After some research I came upon this post and saw that this is an old problem. I modified the patch for Drupal 6 and also improved upon it.

In the above code, there is no fix for the pager. So I added the 'variable_get' to the pager in the search module.

You can find my patch attached here (Drupal 6, might also work in 5).

Regards,

Eddib