You are here

function apachesolr_proximity_form_apachesolr_search_bias_form_alter in Apache Solr Term Proximity 7

Same name and namespace in other branches
  1. 6.3 apachesolr_proximity.module \apachesolr_proximity_form_apachesolr_search_bias_form_alter()

Implements hook_form_FORM_ID_alter for apachesolr_search_bias_form.

File

./apachesolr_proximity.module, line 57
Applies proximity boosting to Solr searches so that the distance between two or more terms is factored in the relevancy.

Code

function apachesolr_proximity_form_apachesolr_search_bias_form_alter(&$form, &$form_state) {
  $weights = drupal_map_assoc(array(
    '21.0',
    '13.0',
    '8.0',
    '5.0',
    '3.0',
    '2.0',
    '1.0',
    '0.8',
    '0.5',
    '0.3',
    '0.2',
    '0.1',
  ));
  $form['proximity_bias'] = array(
    '#title' => t('Term proximity bias'),
    '#type' => 'fieldset',
    '#group' => 'bias_tabs',
    '#description' => t('Specificy the importance of the distance between two or more terms when calculating the relevancy.'),
  );
  $form['proximity_bias'][APACHESOLR_PROXIMITY_VARIABLE] = array(
    '#type' => 'select',
    '#options' => $weights,
    '#title' => t('Term proximity'),
    '#default_value' => apachesolr_proximity_get_boost($form['#env_id']),
  );
  $form['actions']['submit']['#submit'][] = 'apachesolr_proximity_bias_form_submit';
  $form['actions']['reset']['#submit'][] = 'apachesolr_proximity_bias_form_reset';
}