Problem/Motivation

I have two facet block displays within a single view and need to alter the query of only one of them. This is difficult to do since the generated "search id" is the same for both displays.

Proposed resolution

The machine name of the display should be used when generating the "search id" to help uniquely identify each facet block.

Remaining tasks

Reviews needed.

API changes

Changes how SearchAPIQuery's are identified.

Comments

jantoine’s picture

Status: Active » Needs review
StatusFileSize
new3.56 KB

Patch attached!

jantoine’s picture

Patch that actually works!

drunken monkey’s picture

Status: Needs review » Needs work

Please remove the unnecessary README changes. Are there any real changes in there?
Apart from that, I'd generally be fine with the patch, makes sense to me. It'd just be a bit of a problem that people would have to update their configuration … That would be almost impossible to do in a update hook.
I'll have to think about it.

jantoine’s picture

The changes to the README.txt file were specifically to the section that discusses the facet block feature which my code changes. It specifically references some '-facet_block' text which I removed and replaced with the display name. There are other edits where was simply replacing special quotes with regular quotes. I can revert these if desired.

jantoine’s picture

Status: Needs work » Needs review

Per comment #36 from #1188562: [meta] Important project announcements, I am bumping this issue to keep it moving forward.

drunken monkey’s picture

Please remove all changes not relevant to this issue from the README.txt.

Other than that, I guess we can commit this. We'd just need to clearly mention the need to re-configure facet displays in the release notes. (Please remind me if you see a new Search API release and there is no note about this. ;))

drunken monkey’s picture

+++ b/contrib/search_api_views/includes/display_facet_block.inc
@@ -177,7 +177,7 @@ class SearchApiViewsFacetsBlockDisplay extends views_plugin_display_block {
-    $query_options['search id'] = 'search_api_views:' . $this->view->name . '-facets_block';
+    $query_options['search id'] = 'search_api_views:' . $this->view->name . ':' . $this->view->current_display;

Also, I think just removing this line would work equally well, we set the same ID in the query class anyways.
Patch attached.

drunken monkey’s picture

Title: Search Id's unusable for multiple facet block displays in a single view » Fix "search id" for Views facets block display
Status: Needs review » Fixed

Committed. Thanks again!

Status: Fixed » Closed (fixed)

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