updated to 7.x-1.4

This commit is contained in:
Bachir Soussi Chiadmi
2014-02-07 10:05:53 +01:00
parent 62b7436183
commit d7303905a0
18 changed files with 596 additions and 290 deletions

View File

@@ -101,45 +101,50 @@ function hook_search_api_solr_multi_query_alter(array &$call_args, SearchApiMult
}
/**
* Define how Search API Solr should index different data types.
* Provide Solr dynamic fields as Search API 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().
* This serves as a placeholder for documenting additional keys for
* hook_search_api_data_type_info() which are recognized by this module to
* automatically support dynamic field types from the schema.
*
* @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.
* In addition to the keys for the individual types that are defined by
* hook_search_api_data_type_info(), the following keys are regonized:
* - prefix: The Solr field name prefix to use for this type. Should match
* two existing dynamic fields definitions with names "{PREFIX}s_*" and
* "{PREFIX}m_*".
* - always multiValued: (optional) If TRUE, only the dynamic field name
* prefix (without the "_*" portion) with multiValued="true" should be given
* by "prefix", instead of the common prefix part for both the single-valued
* and the multi-valued field. This should be the case for all fulltext
* fields, since they might already be tokenized by the Search API. 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().
*@see hook_search_api_data_type_info()
*/
function hook_search_api_solr_dynamic_field_info() {
function search_api_solr_hook_search_api_data_type_info() {
return array(
'example_type' => array(
'prefix' => 'ex',
// Could be omitted, as FALSE is the default.
'always multiValued' => FALSE,
// You can use any identifier you want here, but it makes sense to use the
// field type name from schema.xml.
'edge_n2_kw_text' => array(
// Stock hook_search_api_data_type_info() info:
'name' => t('Fulltext (w/ partial matching)'),
'fallback' => 'text',
// Dynamic field with name="te_*".
'prefix' => 'te',
// Fulltext types should always be multi-valued.
'always multiValued' => TRUE,
),
'tlong' => array(
// Stock hook_search_api_data_type_info() info:
'name' => t('TrieLong'),
'fallback' => 'integer',
// Dynamic fields with name="its_*" and name="itm_*".
'prefix' => 'it',
),
);
}
/**
* 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".
*/