You are here

function facetapi_get_searcher_info in Facet API 6.3

Same name and namespace in other branches
  1. 7.2 facetapi.module \facetapi_get_searcher_info()
  2. 7 facetapi.module \facetapi_get_searcher_info()

Returns all defined searcher definitions.

Return value

array An array of searcher information. Each array is keyed by the machine readable searcher name and contains the following items:

  • name: The machine readable name of the searcher.
  • label: The human readable name of the searcher displayed in the admin UI.
  • adapter: The adapter plugin ID associated with the searcher.
  • url processor: The URL processor plugin ID associated with the searcher.
  • types: An array containing the types of content indexed by the searcher. A type is usually an entity such as 'node', but it can be a non-entity value as well.
  • path: The MENU_DEFAULT_LOCAL_TASK item which the admin UI page is added to as a MENU_LOCAL_TASK. An empty string if the backend manages the admin UI menu items internally.
  • supports facet missing: TRUE if the searcher supports "missing" facets.
  • supports facet mincount: TRUE if the searcher supports the minimum facet count setting.
  • include default facets: TRUE if the searcher should include the facets defined in facetapi_facetapi_facet_info() when indexing node content, FALSE if they should be skipped.
6 calls to facetapi_get_searcher_info()
current_search_get_searcher_options in contrib/current_search/current_search.module
Returns an array of searcher options.
facetapi_adapter_load in ./facetapi.module
Instantiates the adapter plugin associated with the searcher.
facetapi_block_info in ./facetapi.block.inc
Implements hook_block_info().
facetapi_get_delta_map in ./facetapi.block.inc
Returns a cached delta map of hashes to names.
facetapi_get_facet_info in ./facetapi.module
Returns all defined facet definitions available to the searcher.

... See full list

File

./facetapi.module, line 509
An abstracted facet API that can be used by various search backends.

Code

function facetapi_get_searcher_info() {
  $searcher_info = array();
  foreach (module_implements('facetapi_searcher_info') as $module) {

    // Iterates over the module's searcher definition.
    foreach ((array) module_invoke($module, 'facetapi_searcher_info') as $searcher => $info) {

      // @see http://drupal.org/node/1167974
      // Converts "type" to an array and stores in "types".
      // @todo Remove in later versions.
      if (isset($info['type']) && !isset($info['types'])) {
        $info['types'] = array(
          $info['type'],
        );
      }

      // @see http://drupal.org/node/1304010
      // Converts "url_processor" to "url processor" for consistency.
      // @todo Remove in later versions.
      if (isset($info['url_processor']) && !isset($info['url processor'])) {
        $info['url processor'] = $info['url_processor'];
      }
      $info += array(
        'module' => $module,
        'name' => $searcher,
        'path' => '',
        'types' => array(
          'node',
        ),
        'url processor' => 'standard',
        'supports facet missing' => FALSE,
        'supports facet mincount' => FALSE,
        'include default facets' => TRUE,
      );

      // @see http://drupal.org/node/1167974
      // Makes sure old style "type" is present.
      if (!isset($info['type'])) {
        $info['type'] = $info['types'][key($info['types'])];
      }

      // Maps "types" so we can do faster lookups via isset().
      $info['types'] = drupal_map_assoc($info['types']);
      $searcher_info[$searcher] = $info;
    }
  }
  drupal_alter('facetapi_searcher_info', $searcher_info);
  array_walk($searcher_info, 'facetapi_map_assoc', 'types');
  return $searcher_info;
}