If you need the form field to be placed before any other form field present in the form, you need to use, for the weight, a lower value than the one used from the present form fields. The default value is 0; use a negative value to be sure the form field is always shown first (e.g. −200).
search_form() doesn't use any value for the field's weight, which means the default value is used.
$form['basic'] = array(
'#type' => 'container',
'#attributes' => array('class' => array('container-inline')),
);
$form['basic']['keys'] = array(
'#type' => 'textfield',
'#title' => $prompt,
'#default_value' => $keys,
'#size' => $prompt ? 40 : 20,
'#maxlength' => 255,
);
// processed_keys is used to coordinate keyword passing between other forms
// that hook into the basic search form.
$form['basic']['processed_keys'] = array(
'#type' => 'value',
'#value' => '',
);
$form['basic']['submit'] = array(
'#type' => 'submit',
'#value' => t('Search'),
);