Facets on non-search_api pages
(This is cross posted from here)
I've looked high and low for a solution to my situation. I'm happy if someone can tell me that I've gone about this all wrong. The situation is that I needed facets on a non-search panels page. I've read a lot about how to do this and did have facets appearing (using various techniques but finally settling on Views Context). But the paths that the Facets used always inherited the Panels path. With the above patch in #3 this resolved correct to the Views path. Here is my method. The reason this patch works that this allows search_api_views to set the search_api_base_path. Why does this help? It's a View that is providing the context for the Facets. So to implement. Much of this is taken from http://drupal.org/node/1066278#comment-4405704.
- Enable some modules. Views, Search API, Search views, Solr Search, Facet API, Search facets, Views content panes, Panels (
views search_api search_api_views search_api_solr facetapi search_api_facetapi views_content panels)
- Apply the patch above.
- Create a Search API engine and configure the index. Set it indexing.
- Enable and configure the Facets in Search API
- Create a Views page for the results with a path. You could possibly create a Pane with a path too--not sure.
- Expose the full text search as you like. It's not relevant to this project.
- Also create a View mode (? or variant) as a Context (enable Views Content module to get this). Name this something easy to understand like Search API Views context. Also make sure that you are limiting the number of results (possibly to zero), not sorting or doing anything that costs CPU. Possibly enable caching (I've not yet checked). This doesn't provide the results--just the context for non-search pages.
- Make sure that in the Context settings (for this view mode) you have Use Panel path set to No. This is what causes the View to pass in its own path to the search view rather than allowing it to pick up on the path set by the Panel.
- Create a new Panels page or Mini panel.
- Add the Views Search API Views context as the Context in the Panel (not required context Views, just regular context).
- Add View Context to the panel. Select
View rowas the type. Put it at the top above Facets. I'm still figuring out how to hide the actual context.
- Add the Facets to the panel.
- Save and test the path. Without this patch the Facets will inherit the path from the Panel. With this patch they will correctly inherit the path from the View.