Hi,

(How) can I create hierarchical facets?

Cheers,
Dan.

Comments

cpliakas’s picture

Status: Active » Postponed (maintainer needs more info)

This depends largely on the backend and the field you are working with.

Definitely need more information,
Chris

dbolser’s picture

I'm using Apache Solr, and I can use any field.

I'm not currently indexing Drupal content, but rather pointing Apache Solr at an 'external' index (that I'm free to create however I want). I have 'tags' like taxonomy terms, but I'm not sure how to hook it all into the search page.

For simplicity, I could just 'vanilla' Apache Solr over Drupal content (tagged with terms from a taxonomy) to just get going with hierarchical facets.

Many thanks,
Dan.

cpliakas’s picture

Category: feature » support
Status: Postponed (maintainer needs more info) » Active

Hi Dan.

Thanks for the details.

So the short answer is that if the field had data indexed in a hierarchical manner, i.e. it is a multi-valued field that indexes the item and it's parents, you are half way there. The next thing you have to do is implement hook_factapi_facet_info() to define the facet, paying special attention to the "hierarchy callback" key. This allows you to to define a callback that maps the parents and children.

For some examples, check out the facetapi_facetapi_facet_info() function for defining facets and facetapi_get_taxonomy_hierarchy() for building the hierarchy callback.

Hope this helps,
Chris

cpliakas’s picture

Title: Hierarchical facets? » How can I create hierarchical facets for data managed outsider of Drupal?
Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.