You are here

function apachesolr_field_name_map in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 apachesolr.module \apachesolr_field_name_map()
  2. 5.2 apachesolr.module \apachesolr_field_name_map()
  3. 6.3 apachesolr.module \apachesolr_field_name_map()
  4. 6 apachesolr.module \apachesolr_field_name_map()
  5. 6.2 apachesolr.module \apachesolr_field_name_map()

Try to map a schema field name to a human-readable description.

5 calls to apachesolr_field_name_map()
apachesolr_search_field_bias_form in ./apachesolr_search.admin.inc
Form builder function to set query field weights.
apachesolr_search_load_all_search_types in ./apachesolr_search.module
Function that loads all the search types
apachesolr_search_mlt_block_form in ./apachesolr_search.admin.inc
Form to edit moreLikeThis block settings.
apachesolr_search_mlt_get_fields in ./apachesolr_search.admin.inc
Constructs a list of field names used on the settings form. TODO: This always assumes the default environment!
hook_apachesolr_search_types_alter in ./apachesolr.api.php
Modify the search types as found in the search pages administration

File

./apachesolr.module, line 1823
Integration with the Apache Solr search application.

Code

function apachesolr_field_name_map($field_name) {
  $map =& drupal_static(__FUNCTION__);
  if (!isset($map)) {
    $map = array(
      'content' => t('The full, rendered content (e.g. the rendered node body)'),
      'ts_comments' => t('The rendered comments associated with a node'),
      'tos_content_extra' => t('Extra rendered content or keywords'),
      'tos_name_formatted' => t('Author name (Formatted)'),
      'label' => t('Title or label'),
      'teaser' => t('Teaser or preview'),
      'tos_name' => t('Author name'),
      'path_alias' => t('Path alias'),
      'taxonomy_names' => t('All taxonomy term names'),
      'tags_h1' => t('Body text inside H1 tags'),
      'tags_h2_h3' => t('Body text inside H2 or H3 tags'),
      'tags_h4_h5_h6' => t('Body text inside H4, H5, or H6 tags'),
      'tags_inline' => t('Body text in inline tags like EM or STRONG'),
      'tags_a' => t('Body text inside links (A tags)'),
      'tid' => t('Taxonomy term IDs'),
      'is_uid' => t('User IDs'),
      'bundle' => t('Content type names eg. article'),
      'entity_type' => t('Entity type names eg. node'),
      'ss_language' => t('Language type eg. en or und (undefinded)'),
    );
    if (module_exists('taxonomy')) {
      foreach (taxonomy_get_vocabularies() as $vocab) {
        $map['tm_vid_' . $vocab->vid . '_names'] = t('Taxonomy term names only from the %name vocabulary', array(
          '%name' => $vocab->name,
        ));
        $map['im_vid_' . $vocab->vid] = t('Taxonomy term IDs from the %name vocabulary', array(
          '%name' => $vocab->name,
        ));
      }
    }
    foreach (apachesolr_entity_fields('node') as $field_nm => $nodefields) {
      foreach ($nodefields as $field_info) {
        $map[apachesolr_index_key($field_info)] = t('Field of type @type: %label', array(
          '@type' => $field_info['field']['type'],
          '%label' => $field_info['display_name'],
        ));
      }
    }
    drupal_alter('apachesolr_field_name_map', $map);
  }
  return isset($map[$field_name]) ? $map[$field_name] : $field_name;
}