You are here

function apachesolr_search_get_hierarchical_vocabularies in Apache Solr Search 5.2

Same name and namespace in other branches
  1. 6 apachesolr_search.module \apachesolr_search_get_hierarchical_vocabularies()
  2. 6.2 apachesolr_search.module \apachesolr_search_get_hierarchical_vocabularies()

Return an array of taxonomy facets that should be displayed hierarchically.

2 calls to apachesolr_search_get_hierarchical_vocabularies()
apachesolr_search_currentsearch_block in ./apachesolr_search.module
Return the contents of the "Current search" block.
apachesolr_search_taxonomy_facet_block in ./apachesolr_search.module
Generate the facet block for a taxonomy vid delta.

File

./apachesolr_search.module, line 1205
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function apachesolr_search_get_hierarchical_vocabularies() {
  static $result;
  if (!isset($result)) {
    $result = array();
    if (function_exists('taxonomy_get_vocabularies')) {
      $vocabularies = taxonomy_get_vocabularies();
      $force_flat = variable_get('apachesolr_search_force_flat_vocabularies', array());
      foreach ($vocabularies as $voc) {

        // If the vocabulary is not multiple-parent hierarchical and not
        // freetagging and not designated to be forced to display flat.
        if ($voc->hierarchy != 2 && $voc->tags != 1 && empty($force_flat[$voc->vid])) {
          $result[$voc->vid] = 1;
        }
      }
    }
  }
  return $result;
}