You are here

function search_api_solr_hook_search_api_data_type_info in Search API Solr 7

Same name and namespace in other branches
  1. 8.3 search_api_solr.api.php \search_api_solr_hook_search_api_data_type_info()
  2. 8 search_api_solr.api.php \search_api_solr_hook_search_api_data_type_info()
  3. 8.2 search_api_solr.api.php \search_api_solr_hook_search_api_data_type_info()
  4. 4.x search_api_solr.api.php \search_api_solr_hook_search_api_data_type_info()

Provide Solr dynamic fields as Search API data types.

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 value

array 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 also

hook_search_api_data_type_info()

File

./search_api_solr.api.php, line 141
Hooks provided by the Search API Solr search module.

Code

function search_api_solr_hook_search_api_data_type_info() {
  return array(
    // 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',
    ),
  );
}