function apachesolr_search_bias_form in Apache Solr Search 6.2
Same name and namespace in other branches
- 8 apachesolr_search.admin.inc \apachesolr_search_bias_form()
- 5.2 apachesolr_search.admin.inc \apachesolr_search_bias_form()
- 6.3 apachesolr_search.admin.inc \apachesolr_search_bias_form()
- 6 apachesolr_search.admin.inc \apachesolr_search_bias_form()
- 7 apachesolr_search.admin.inc \apachesolr_search_bias_form()
Form builder function to set date, comment, etc biases.
1 string reference to 'apachesolr_search_bias_form'
- apachesolr_boost_settings_page in ./
apachesolr_search.admin.inc - Menu callback - boosts settings form.
File
- ./
apachesolr_search.admin.inc, line 39 - Administrative settings for searching.
Code
function apachesolr_search_bias_form($form_state) {
$date_settings = variable_get('apachesolr_search_date_boost', '4:200.0');
$comment_settings = variable_get('apachesolr_search_comment_boost', '0:0');
$changed_settings = variable_get('apachesolr_search_changed_boost', '0:0');
$sticky_boost = variable_get('apachesolr_search_sticky_boost', '0');
$promote_boost = variable_get('apachesolr_search_promote_boost', '0');
$options = array(
'10:2000.0' => '10',
'8:1000.0' => '9',
'8:700.0' => '8',
'8:500.0' => '7',
'4:300.0' => '6',
'4:200.0' => '5',
'4:150.0' => '4',
'2:150.0' => '3',
'2:100.0' => '2',
'1:100.0' => '1',
'0:0' => t('Ignore'),
);
$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',
));
$weights['0'] = t('Ignore');
$form['biasing'] = array(
'#type' => 'fieldset',
'#title' => t('Result biasing'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#description' => t('Give bias to certain properties when ordering the search results. Any value except <em>Ignore</em> will increase the score of the given type in search results. Choose <em>Ignore</em> to ignore any given property.'),
);
$form['biasing']['apachesolr_search_sticky_boost'] = array(
'#type' => 'select',
'#options' => $weights,
'#title' => t("Sticky at top of lists"),
'#default_value' => $sticky_boost,
'#description' => t("Select additional bias to give to nodes that are set to be 'Sticky at top of lists'."),
);
$form['biasing']['apachesolr_search_promote_boost'] = array(
'#type' => 'select',
'#options' => $weights,
'#title' => t("Promoted to home page"),
'#default_value' => $promote_boost,
'#description' => t("Select additional bias to give to nodes that are set to be 'Promoted to home page'."),
);
$form['biasing']['apachesolr_search_date_boost'] = array(
'#type' => 'select',
'#options' => $options,
'#title' => t("More recently created"),
'#default_value' => $date_settings,
'#description' => t('This setting will change the result scoring so that nodes created more recently may appear before those with higher keyword matching.'),
);
$form['biasing']['apachesolr_search_comment_boost'] = array(
'#type' => 'select',
'#options' => $options,
'#title' => t("More comments"),
'#default_value' => $comment_settings,
'#description' => t('This setting will change the result scoring so that nodes with more comments may appear before those with higher keyword matching.'),
);
$form['biasing']['apachesolr_search_changed_boost'] = array(
'#type' => 'select',
'#options' => $options,
'#title' => t("More recent comments"),
'#default_value' => $changed_settings,
'#description' => t('This setting will change the result scoring so that nodes with the most recent comments (or most recent updates to the node itself) may appear before those with higher keyword matching.'),
);
$form = system_settings_form($form);
$form['biasing']['buttons'] = $form['buttons'];
unset($form['buttons']);
return $form;
}