patch add custom field types

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy
2013-03-12 19:15:12 +01:00
parent 6a402551d7
commit c9912105d5
4 changed files with 336 additions and 24 deletions

View File

@@ -84,6 +84,46 @@ function hook_search_api_solr_multi_query_alter(array &$call_args, SearchApiMult
}
}
/**
* Define how Search API Solr should index different data types.
*
* It is important to make sure that any types you define are also declared to
* Search API using hook_search_api_data_type_info().
*
* @return array
* An array containing data type definitions, keyed by their type identifier
* and containing the following keys:
* - prefix: The prefix used by the dynamic field type.
* - always multiValued: (optional) Whether the single/multiple prefix should
* be skipped for this data type. Defaults to FALSE.
*
* @see hook_search_api_solr_dynamic_field_info_alter()
* @see search_api_solr_get_dynamic_field_info()
* @see hook_search_api_data_type_info().
*/
function hook_search_api_solr_dynamic_field_info() {
return array(
'example_type' => array(
'prefix' => 'ex',
// Could be omitted, as FALSE is the default.
'always multiValued' => FALSE,
),
);
}
/**
* Alter the data type indexing info.
*
* @param array $infos
* The item type info array, keyed by type identifier.
*
* @see hook_search_api_solr_dynamic_field_info()
*/
function hook_search_api_solr_dynamic_field_info_alter(array &$infos) {
// Change the prefix used for example_type.
$info['example_type']['prefix'] = 'ex2';
}
/**
* @} End of "addtogroup hooks".
*/