Use Taxonomy Paths for Searches

Last updated on
24 March 2017

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Why

lets say you have a menu on the sidebar (often generated by taxonomy_menu) and you want the links to send you to a search page. The Apachesolr has that in code, with the search_api you can do this with views.

Howto with a single Vocabulary

Basic Workflow (D7 views 3):

1.) Make a view and add your search index
2.) Add the fields you want to show
3.) As path you type /taxonomy/term/%
4.) Contextual Filters: Add the term id (in my case i chose the main category which represents my menu)

Attention you need to index the term id field or it will NOT appear:
1.) Go to: /admin/config/search/search_api/overview
2.) Addyour vocabulary
3.)Add related fields and add the vocabulary there again. Now you are able to set checkboxes, name and term id.

Image of views settings attached.

Multiple taxonomy vocabularys using aggregation

If you want to add multiple taxonomy vocabularys as a contextual filter you need to aggregate them first. Search api provides this function. It can be found under WORKFLOW. Then add that aggregated field to your views

Issues with similar problems (just for reference)

#1202814: Filtering by taxonomy ID
#1119594: Fix Views argument handlers

Modules handling taxonomy

http://drupal.org/project/search_api_node_taxonomy_list

Help improve this page

Page status: No known problems

You can: