Implementing a search and results page in the admin interface I'm trying to implement a search and results form in the admin interface but I am having trouble getting the search function and pager working.

[1] The pager is not showing at all. I've got this working using db_select for the query but I'd like to use a solr query. How can I get a pager to display?

[2] The form submission is not working as expected either. On submission the page is redirect to the correct url but an error message is displayed: The requested page '/admin/monitor/custom/search/?q=foobar' could not be found. Do i have to declare a separate menu route /admin/monitor/custom/search/% to handle searches?

Many thanks,

function custom_menu(){
    $items['admin/monitor/custom/search'] = array(
      'title' =&gt; 'Custom',
      'description' =&gt;'Custom search form',
      'page callback' =&gt; 'drupal_get_form',
      'page arguments' =&gt; array('custom_form'),
      'access arguments' =&gt; array('administer site configuration'),
    );
    return items;
}

function custom_form($form, &amp;$form_state){

    $table = build_results_table();

    $form['keyword'] = array(
      '#type' =&gt; 'textfield',
      '#description' =&gt; t('Search database by keyword'),
    );

    $form['submit'] = array(
      '#type' =&gt; 'submit',
      '#value' =&gt; 'Go!'
    );

    $form['results'] = array(
      '#markup' =&gt; $table,
    );

    return $form;
  }

function build_results_table($search_term){

    // perform query using Solr Search API
    // page number from $_GET('page')
    // search limit from a variable set by another module
    $results = query_database();

    $header = array('Firstname', 'Middlename', 'Surname');

    $rows = //... build rows from $results ...;

    $table = theme('table', array(
      'header' =&gt; $header,
      'rows'=&gt;$rows,
    ));

    pager_default_initialize($table);
    $table .= theme('pager');

    return $table;
}

function custom_custom_form_submit($form, &amp;$form_state){

    $keyword = $form_state['values']['keyword'];
    drupal_set_message(t('Showing results for %keyword',
    array('%keyword' =&gt; $keyword)));

    $form_state['redirect'] =
    '/admin/monitor/custom/search/?q='. $keyword;

}
Drupal only has only pager implementations for DB queries, but you can use the pager system manually for data in external sources. There are a couple of examples on the pager_default_initialize() docs that should get you started.
Anything other than q as the param name should work - Drupal uses q as the path param in its rewrites, so it's probably trying to find a route of foobar in your example.