Last updated May 20, 2013. Created by marcoka on December 12, 2011.
Edited by drunken monkey. Log in to edit this page.
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
| Attachment | Size |
|---|---|
| views_SETTINGS.png | 48.79 KB |
Comments
Need ApacheSOLR?
Does this howto require ApacheSOLR?
or can you do it with Search API Database Search without SOLR?
i only tested it with solr. i
i only tested it with solr. i havent done much testing with the db module.