function apachesolr_index_key in Apache Solr Search 7
Same name and namespace in other branches
- 8 apachesolr.module \apachesolr_index_key()
- 5.2 apachesolr.module \apachesolr_index_key()
- 5 apachesolr.module \apachesolr_index_key()
- 6.3 apachesolr.module \apachesolr_index_key()
- 6 apachesolr.module \apachesolr_index_key()
- 6.2 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
File
- ./
apachesolr.module, line 1726 - 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_';
// Legacy: Block deltas are limited to 32 chars. Keep it like this for backwards compatibility
$apachesolr_field_length_limit = variable_get('apachesolr_field_length_limit', '32');
if ($apachesolr_field_length_limit <= 0) {
return $type_prefix . $sm . $field['name'];
}
else {
return substr($type_prefix . $sm . $field['name'], 0, $apachesolr_field_length_limit);
}
}