Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dasjo’s picture

Status: Active » Needs review

the attached patch will set search_api_base_path for any search api view, if it isn't set manually.
hope this makes sense, please see the above issue + its linked predecessors for details :)

dasjo’s picture

ops, here's the patch

dasjo’s picture

digging into the views api turns out, it might be better to use get_url instead of get_path, as this one should contain arguments as well.

dasjo’s picture

Status: Needs review » Closed (works as designed)

we have fixed this within pretty paths, see #1861786: Fix base path issues

queenvictoria’s picture

Status: Closed (works as designed) » Needs review

I'd love for this to be reopened. In fact I'll do that. 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 page 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.

  1. 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)
  2. Apply the patch above.
  3. Create a Search API engine and configure the index. Set it indexing.
  4. Enable and configure the Facets in Search API
  5. Create a Views page for the results with a path. You could possibly create a Pane with a path too--not sure.
  6. Expose the full text search as you like. It's not relevant to this project.
  7. 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.
  8. 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.
  9. Create a new Panels page or Mini panel.
  10. Add the Views Search API Views context as the Context in the Panel (not required context Views, just regular context).
  11. Add View Context to the panel. Select View row as the type. Put it at the top above Facets. I'm still figuring out how to hide the actual context.
  12. Add the Facets to the panel.
  13. 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.
queenvictoria’s picture

I'm working on a different approach over here which allows the Panel to override the View path providing a (potentially) third path.
https://drupal.org/node/2088905

kopeboy’s picture

Issue summary: View changes

I cannot get this to work.

I am using a View: Content Pane with Contextual filter: Search taxonomy term fields, and putting that on a Panel page (taxonomy term template) with path taxonomy/term/%term, then placing the Search API index View content pane and the Facets.

> The facets don't work, on click I get error:
EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7746 of /srv/bindings/8036422060ee456b87e0ee13c0f08bad/code/includes/common.inc).

Should this work?

Why I want to use panels:
1) I want the taxonomy terms linked to the search page for their vocabulary
2) I want to place other elements in that search page, for example the term description & image, but also another view of ads or a map
3) different users would see different things

drunken monkey’s picture

Does it work on a normal view, without the Panel page? This error looks weird, and not like it would be caused by Panels. On the other hand, it might be a problem with the URL/path. Are you maybe using Facet API Pretty Paths or something for your facets?

kopeboy’s picture

It works on a normal View. I am using pretty paths, but I did not test with this patch yet.

drunken monkey’s picture

Status: Needs review » Closed (duplicate)
akalam’s picture

#3 does not apply against the current -dev.

Here is an attached patch that apply