@@ -143,3 +143,81 @@ function search_api_solr_cron() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns either all dynamic field types, or a specific one.
|
||||
*
|
||||
* @param $type
|
||||
* If specified, the type whose definition should be returned.
|
||||
*
|
||||
* @return array
|
||||
* If $type was not given, an array containing all custom dynamic fields, in
|
||||
* the format specified by hook_search_api_solr_dynamic_field_info().
|
||||
* Otherwise, the definition for the given type, or NULL if it is unknown.
|
||||
*
|
||||
* @see hook_search_api_solr_dynamic_field_info().
|
||||
*/
|
||||
function search_api_solr_get_dynamic_field_info($type = NULL) {
|
||||
$types = &drupal_static(__FUNCTION__);
|
||||
if (!isset($types)) {
|
||||
$types = module_invoke_all('search_api_solr_dynamic_field_info');
|
||||
$types = $types ? $types : array();
|
||||
drupal_alter('search_api_solr_dynamic_field_info', $types);
|
||||
}
|
||||
if (isset($type)) {
|
||||
return isset($types[$type]) ? $types[$type] : NULL;
|
||||
}
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_search_api_solr_dynamic_field_info().
|
||||
*/
|
||||
function search_api_solr_search_api_solr_dynamic_field_info() {
|
||||
return array(
|
||||
'text' => array(
|
||||
'prefix' => 'tm',
|
||||
'always multiValued' => TRUE,
|
||||
),
|
||||
'tokens' => array(
|
||||
'prefix' => 'tm',
|
||||
'always multiValued' => TRUE,
|
||||
),
|
||||
'string' => array(
|
||||
'prefix' => 's',
|
||||
'always multiValued' => FALSE,
|
||||
),
|
||||
'integer' => array(
|
||||
'prefix' => 'i',
|
||||
'always multiValued' => FALSE,
|
||||
),
|
||||
'decimal' => array(
|
||||
'prefix' => 'f',
|
||||
'always multiValued' => FALSE,
|
||||
),
|
||||
'date' => array(
|
||||
'prefix' => 'd',
|
||||
'always multiValued' => FALSE,
|
||||
),
|
||||
'duration' => array(
|
||||
'i',
|
||||
'always multiValued' => FALSE,
|
||||
),
|
||||
'boolean' => array(
|
||||
'b',
|
||||
'always multiValued' => FALSE,
|
||||
),
|
||||
'uri' => array(
|
||||
's',
|
||||
'always multiValued' => FALSE,
|
||||
),
|
||||
'location' => array(
|
||||
'loc',
|
||||
'always multiValued' => FALSE,
|
||||
),
|
||||
'geohash' => array(
|
||||
'geohash',
|
||||
'always multiValued' => FALSE,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user