function apachesolr_cck_fields in Apache Solr Search 5
Same name and namespace in other branches
- 5.2 apachesolr.module \apachesolr_cck_fields()
- 6 apachesolr.module \apachesolr_cck_fields()
- 6.2 apachesolr.module \apachesolr_cck_fields()
This invokes the hook_apachesolr_cck_field_mappings to find out how to handle CCK fields.
4 calls to apachesolr_cck_fields()
- ApacheSolrUpdate::update_index in ./
apachesolr.module - apachesolr_multisitesearch_search in contrib/
apachesolr_multisitesearch/ apachesolr_multisitesearch.module - Implementation of hook_search().
- apachesolr_search_block in ./
apachesolr_search.module - Implementation of hook_block().
- apachesolr_search_search in ./
apachesolr_search.module - Implementation of hook_search().
File
- ./
apachesolr.module, line 796 - Integration with the Apache Solr search application.
Code
function apachesolr_cck_fields() {
static $_fields;
// If CCK isn't enabled, do nothing.
if (module_exists('content')) {
$mappings = module_invoke_all('apachesolr_cck_field_mappings');
if (is_null($_fields)) {
$_fields = array();
$result = db_query("SELECT i.field_name, f.multiple, f.type, i.widget_type FROM {node_field_instance} i INNER JOIN {node_field} f ON i.field_name = f.field_name;");
while ($row = db_fetch_object($result)) {
// Only deal with fields that have options widgets (facets don't make sense otherwise), or fields that have specific mappings.
if ($row->type == 'text' && in_array($row->widget_type, array(
'options_select',
'options_buttons',
)) || in_array($row->type, array_keys($mappings))) {
$_fields[$row->field_name] = array(
'name' => $row->field_name,
'multiple' => $row->multiple ? TRUE : FALSE,
'field_type' => $row->type,
'index_type' => empty($mappings) ? 'string' : $mappings[$row->type]['index_type'],
'callback' => empty($mappings[$row->type]['callback']) ? NULL : $mappings[$row->type]['callback'],
);
}
}
}
return $_fields;
}
else {
return array();
}
}