function apachesolr_search_type_boost_form in Apache Solr Search 5.2
Same name and namespace in other branches
- 8 apachesolr_search.admin.inc \apachesolr_search_type_boost_form()
- 6.3 apachesolr_search.admin.inc \apachesolr_search_type_boost_form()
- 6 apachesolr_search.admin.inc \apachesolr_search_type_boost_form()
- 6.2 apachesolr_search.admin.inc \apachesolr_search_type_boost_form()
- 7 apachesolr_search.admin.inc \apachesolr_search_type_boost_form()
Form builder function to set query type weights.
1 string reference to 'apachesolr_search_type_boost_form'
- apachesolr_boost_settings_page in ./
apachesolr_search.admin.inc - Menu callback - boosts settings form.
File
- ./
apachesolr_search.admin.inc, line 179 - Administrative settings for searching.
Code
function apachesolr_search_type_boost_form() {
$form = array();
$form['apachesolr_search_type_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Type biasing and exclusion'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['apachesolr_search_type_settings']['apachesolr_search_type_boosts'] = array(
'#type' => 'item',
'#description' => t("Specify here which node types should get a higher relevancy score in searches. Any value except <em>Ignore</em> will increase the score of the given type in search results."),
'#tree' => TRUE,
);
$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');
// Get the current boost values.
$type_boosts = variable_get('apachesolr_search_type_boosts', array());
$names = node_get_types('names');
foreach ($names as $type => $name) {
$form['apachesolr_search_type_settings']['apachesolr_search_type_boosts'][$type] = array(
'#type' => 'select',
'#title' => t('%type type content bias', array(
'%type' => $name,
)),
'#options' => $weights,
'#default_value' => isset($type_boosts[$type]) ? $type_boosts[$type] : 0,
);
}
$form['apachesolr_search_type_settings']['apachesolr_search_excluded_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Types to exclude from the search index'),
'#options' => $names,
'#default_value' => variable_get('apachesolr_search_excluded_types', array()),
'#description' => t("Specify here which node types should be totally excluded from the search index. Content excluded from the index will never appear in any search results."),
);
$form = system_settings_form($form);
$form['apachesolr_search_type_settings']['buttons'] = $form['buttons'];
unset($form['buttons']);
return $form;
}