WARNING: always back up your files before hacking them!
The # of search results is not an end-user changeable feature. It is hard-coded.
That being said, I believe that you can change the number from 10 results by changing the number "10" to "25" (or whatever) in two places: ~line 867 (do_search() function) and ~line 1262 (theme_search_page() function) in search.module.
I wrote a little patch that adds a setting you can adjust in administer/search.
Perhaps it should be added to cvs some day...
I assume you know how to patch files.. if not.. just add/replace the relevant lines.
--- search.module Mon Jul 17 15:14:30 2006
+++ search.module Mon Aug 21 11:21:00 2006
@@ -223,10 +223,14 @@
$form['indexing_settings'] = array('#type' => 'fieldset', '#title' => t('Indexing settings'));
$form['indexing_settings']['info'] = array('#type' => 'markup', '#value' => '<em>'. t('<p>Changing the settings below will cause the site index to be rebuilt. The search index is not cleared but systematically updated to reflect the new settings. Searching will continue to work but new content won\'t be indexed until all existing content has been re-indexed.</p><p>The default settings should be appropriate for the majority of sites.</p>') .'</em>');
$form['indexing_settings']['minimum_word_size'] = array('#type' => 'textfield', '#title' => t('Minimum word length to index'), '#default_value' => variable_get('minimum_word_size', 3), '#size' => 5, '#maxlength' => 3, '#description' => t('The number of characters a word has to be to be indexed. A lower setting means better search result ranking, but also a larger database. Each search query must contain at least one keyword that is this size (or longer).'));
$form['indexing_settings']['overlap_cjk'] = array('#type' => 'checkbox', '#title' => t('Simple CJK handling'), '#default_value' => variable_get('overlap_cjk', true), '#description' => t('Whether to apply a simple Chinese/Japanese/Korean tokenizer based on overlapping sequences. Turn this off if you want to use an external preprocessor for this instead. Does not affect other languages.'));
+ // Search results:
+ $form['results'] = array('#type' => 'fieldset', '#title' => t('Search results'));
+ $form['results']['search_results_per_page'] = array('#type' => 'select', '#title' => t('Results per page'), '#default_value' => variable_get('search_results_per_page', 10), '#options' => drupal_map_assoc(range(5, 50, 5)), '#description' => t('Maximum results per page.'));
+
// Per module settings
$form = array_merge($form, module_invoke_all('search', 'admin'));
return $form;
}
@@ -862,11 +866,11 @@
return array();
}
$count_query = "SELECT $count";
// Do actual search query
- $result = pager_query("SELECT * FROM temp_search_results", 10, 0, $count_query);
+ $result = pager_query("SELECT * FROM temp_search_results", variable_get('search_results_per_page', 10), 0, $count_query);
$results = array();
while ($item = db_fetch_object($result)) {
$results[] = $item;
}
return $results;
@@ -1254,9 +1258,9 @@
foreach ($results as $entry) {
$output .= theme('search_item', $entry, $type);
}
$output .= '</dl>';
- $output .= theme('pager', NULL, 10, 0);
+ $output .= theme('pager', NULL, variable_get('search_results_per_page', 10), 0);
return $output;
}
- p
Ps. it would be nice if someone could point me to where i should post this as a feature/issue for cvs branch.
I created a file called search.patch and put it in the same directory as the search.module.
Issued the command patch search.patch but it seemed to get stuck somewhere in the patch. I've done this occasionally in the past without problems but this time it didn't seem to work.
I copied your code and pasted it into BBEdit.
Since I cannot attach a gif to this reply I pasted the beginning of each row below. Maybe something went wrong when copying and pasting from your post?
I'm not sure why I can't get the patch to work. I used the other approach which worked fine. Maybe yours will be implemented in 4.8 which would be great. Thanks for trying to help me :-)
Comments
not sure
WARNING: always back up your files before hacking them!
The # of search results is not an end-user changeable feature. It is hard-coded.
That being said, I believe that you can change the number from 10 results by changing the number "10" to "25" (or whatever) in two places: ~line 867 (
do_search()function) and ~line 1262 (theme_search_page()function) insearch.module.Hope that helps!
- Corey
Thanks :-) It seems so far
Thanks :-) It seems so far to work like a charm!
Try this little patch i wrote
Hi,
I wrote a little patch that adds a setting you can adjust in administer/search.
Perhaps it should be added to cvs some day...
I assume you know how to patch files.. if not.. just add/replace the relevant lines.
- p
Ps. it would be nice if someone could point me to where i should post this as a feature/issue for cvs branch.
I created a file called
I created a file called search.patch and put it in the same directory as the search.module.
Issued the command patch search.patch but it seemed to get stuck somewhere in the patch. I've done this occasionally in the past without problems but this time it didn't seem to work.
I copied your code and pasted it into BBEdit.
Since I cannot attach a gif to this reply I pasted the beginning of each row below. Maybe something went wrong when copying and pasting from your post?
Pastebin
Hi,
Try getting the code from here instead http://pastebin.com/773079
Seems like the indents gets lost in translation in that code field above.
I'm not sure why I can't get
I'm not sure why I can't get the patch to work. I used the other approach which worked fine. Maybe yours will be implemented in 4.8 which would be great. Thanks for trying to help me :-)