Index: sphinxsearch.admin.inc =================================================================== --- sphinxsearch.admin.inc (revision 524) +++ sphinxsearch.admin.inc (working copy) @@ -208,8 +208,8 @@ '#type' => 'select', '#title' => t('Results per page'), '#default_value' => variable_get('sphinxsearch_results_per_page', 10), - '#options' => drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100)), - '#description' => t('How many items will be shown on search results page.'), + '#options' => drupal_map_assoc(array(10, 20, 30, 50, 100)), + '#description' => t('How many items will be shown on search results page by default.'), ); $form['search']['results']['sphinxsearch_log_search_keys'] = array( '#type' => 'radios', Index: sphinxsearch.common.inc =================================================================== --- sphinxsearch.common.inc (revision 571) +++ sphinxsearch.common.inc (working copy) @@ -336,6 +336,9 @@ if (!empty($search_options['sortdir']) && $search_options['sortdir'] == 'ASC') { $query['sortdir'] = 'ASC'; } + if (!empty($search_options['results_per_page'])) { + $query['results_per_page'] = $search_options['results_per_page']; + } return (!empty($query) ? str_replace('%2C', ',', drupal_query_string_encode($query)) : NULL); } @@ -351,7 +354,6 @@ function sphinxsearch_parse_request($request_options = array()) { $search_options = array( 'matchmode' => SPHINXSEARCH_MATCH_ALL, - 'results_per_page' => (int)variable_get('sphinxsearch_results_per_page', 10), 'excerpts_limit' => (int)variable_get('sphinxsearch_excerpts_limit', 256), 'excerpts_around' => (int)variable_get('sphinxsearch_excerpts_around', 5), 'excerpts_single_passage' => (int)variable_get('sphinxsearch_excerpts_single_passage', 0), @@ -460,6 +462,9 @@ if (!empty($request_options['sortdir'])) { $search_options['sortdir'] = $request_options['sortdir']; } + if (!empty($request_options['results_per_page'])) { + $search_options['results_per_page'] = $request_options['results_per_page']; + } + $search_options['results_per_page'] = (int)$search_options['results_per_page']; return $search_options; } @@ -503,7 +508,7 @@ // Validate results per page option. if (!isset($search_options['results_per_page']) || $search_options['results_per_page'] <= 0) { - $search_options['results_per_page'] = 10; + $search_options['results_per_page'] = variable_get('sphinxsearch_results_per_page', 10); } // Quit if no search filter has been specified. Index: sphinxsearch.pages.inc =================================================================== --- sphinxsearch.pages.inc (revision 524) +++ sphinxsearch.pages.inc (working copy) @@ -269,6 +269,14 @@ '#options' => array('ASC' => t('Ascending'), 'DESC' => t('Descending')), '#default_value' => (isset($search_options['sortdir']) ? $search_options['sortdir'] : 'DESC'), ); + $form['advanced']['results_per_page'] = array( + '#type' => 'select', + '#title' => t('Results per page'), + '#prefix' => '
', + '#suffix' => '
', + '#options' => drupal_map_assoc(array(10, 20, 30, 50, 100)), + '#default_value' => (isset($search_options['results_per_page']) ? $search_options['results_per_page'] : variable_get('sphinxsearch_results_per_page', 10)), + ); $form['advanced']['submit'] = array( '#type' => 'submit',