You are here

function apachesolr_index_key in Apache Solr Search 8

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

Construct a dynamic index name based on information about a field.

Parameters

array $field: array( 'index_type' => 'integer', 'multiple' => TRUE, 'name' => 'fieldname', ),

Return value

string Fieldname as it appears in the solr index

6 calls to apachesolr_index_key()
ApacheSolrFacetapiNumericRange::execute in plugins/facetapi/query_type_numeric_range.inc
Adds the filter to the query object.
apachesolr_entityreference_indexing_callback in ./apachesolr.index.inc
Indexing callback for entityreference fields.
apachesolr_entity_field_facets in ./apachesolr.module
Returns an array of facets for the provided entity type's fields.
apachesolr_fields_default_indexing_callback in ./apachesolr.index.inc
Callback that converts list module field into an array For every multivalued value we also add a single value to be able to use the stats
apachesolr_nodereference_indexing_callback in ./apachesolr.index.inc
Indexing callback for the node_reference module by the references module

... See full list

File

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

Code

function apachesolr_index_key($field) {
  $index_type = !empty($field['index_type']) ? $field['index_type'] : NULL;
  switch ($index_type) {
    case 'text':
      $type_prefix = 't';
      break;
    case 'text-omitNorms':
      $type_prefix = 'to';
      break;
    case 'text-unstemmed':
      $type_prefix = 'tu';
      break;
    case 'text-edgeNgram':
      $type_prefix = 'te';
      break;
    case 'text-whiteSpace':
      $type_prefix = 'tw';
      break;
    case 'integer':
      $type_prefix = 'i';

      // long integer
      break;
    case 'half-int':
      $type_prefix = 'h';

      // 32 bit integer
      break;
    case 'float':
      $type_prefix = 'f';

      // float; sortable.
      break;
    case 'double':
      $type_prefix = 'p';

      // double; sortable d was used for date.
      break;
    case 'boolean':
      $type_prefix = 'b';
      break;
    case 'tint':
      $type_prefix = 'it';

      // long integer trie; sortable, best for range queries
      break;
    case 'thalf-int':
      $type_prefix = 'ht';

      // 32 bit integer trie (sortable)
      break;
    case 'tfloat':
      $type_prefix = 'ft';

      // float trie; sortable, best for range queries.
      break;
    case 'tdouble':
      $type_prefix = 'pt';

      // double trie;
      break;
    case 'sint':
      $type_prefix = 'is';

      // long integer sortable (deprecated)
      break;
    case 'half-sint':
      $type_prefix = 'hs';

      // 32 bit integer long sortable (deprecated)
      break;
    case 'sfloat':
      $type_prefix = 'fs';

      // float, sortable (use for sorting missing last) (deprecated).
      break;
    case 'sdouble':
      $type_prefix = 'ps';

      // double sortable; (use for sorting missing last) (deprecated).
      break;
    case 'date':
      $type_prefix = 'd';

      // date trie (sortable)
      break;
    case 'date-deprecated':
      $type_prefix = 'dd';

      // date (regular)
      break;
    case 'binary':
      $type_prefix = 'x';

      // Anything that is base64 encoded
      break;
    case 'storage':
      $type_prefix = 'z';

      // Anything that just need to be stored, not indexed
      break;
    case 'point':
      $type_prefix = 'point';

      // PointType. "52.3672174,4.9126891"
      break;
    case 'location':
      $type_prefix = 'loc';

      // LatLonType. "52.3672174,4.9126891"
      break;
    case 'geohash':
      $type_prefix = 'geo';

      // GeohashField. "42.6" http://en.wikipedia.org/wiki/Geohash
      break;
    case 'string':
    default:
      $type_prefix = 's';
  }
  $sm = !empty($field['multiple']) ? 'm_' : 's_';

  // Block deltas are limited to 32 chars.
  return substr($type_prefix . $sm . $field['name'], 0, 32);
}