Closed (fixed)
Project:
Search API
Version:
7.x-1.x-dev
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 May 2012 at 15:39 UTC
Updated:
17 Dec 2013 at 09:10 UTC
Jump to comment: Most recent
Comments
Comment #1
rooby commentedYou should be able to do it.
I have a search api view with facet blocks that use the select widget.
In you view's facet block settings make sure "Hide block" is set to "Yes", then instead of putting the views facet block on your search page put the facetapi facet block.
Then you change the facet api facet settings for the widget and it should work as expected.
Comment #2
webavant commentedWhen I set "hide block" to "yes", the block no longer displays on other pages besides the view page.
Comment #3
webavant commentedIt seems I have to put the hidden views facet block into the same region with the regular facet api blocks. Is that intended?
Comment #4
rooby commentedI can't say I have tried to do that with the facet blocks on non-search pages.
I see you have seen #1417456-19: Facets on non-search Search API pages broken by facetapi_block_list_alter removing the block, which explains the issues surrounding that.
So either this has to be fixed. Or #1235026-27: Show facet blocks everywhere including non search pages has to be fixed. Or both.
Comment #5
webavant commentedI struggled for a very long time with it. The current behavior is that the views facet blocks lose the widget style unless you set "hide block" to "yes" and put it in a region with regular facet API blocks. I also installed this patch, so I'm not sure it behaves the same way prior to that patch.
Comment #6
alexweber commentedRunning into this myself. I don't think the problem is that it doesn't have a widget style display option per-se, but rather that it doesn't respect the widget style option defined in the facet's configuration. (The views block doesn't allow you to change any of the other facet settings anyway)
In
display_facet_block.inc:Notice how it explicitly just renders the facets as links. Still trying to figure out what's the best way to fix this... Any ideas?
PS - Also confirming that, it might take some tweaking of the "Display for searches" facet setting but the solution in #5 works :)
Comment #7
drunken monkeyI'm not sure I understand all the problems mentioned in this issue. However, maybe this handbook page can throw some light on some of your problems.
First off, the Views "Facets Block" display is meant as a very crude way to display facets on non-search pages. I couldn't figure out how to flexibly include any of the settings/functionality available for Facet API settings – so I didn't attempt to duplicate these but just provided a way to use Facet API facets with this block, circumventing the problem (though leading to some others).
The problem some of you are seeing might be that the Views block (with the Facets block display view) is rendered after the Facet API facet blocks. Thus, the Facet API facet blocks don't see any search and conclude that there are no facets to be displayed. See also the FAQs for this problem. Just move the Views block around until you find a place where it is rendered before all facet blocks, and it should be fine.
I hope this could help.
(If anyone knows how to include Facet API facets into a Views block, I'd be glad to add that, too, though. As said, it's just that I couldn't figure out how this could be done.)
Comment #8
ressaThanks for adding that to the handbook just yesterday, when I needed it today :-)
My problem was that my "Facets block" wasn't put before the other Facet API blocks ("Facet API: Search service: ..."). As soon as the "Facets block" was above them, even in the same region, all the search facets were displayed on non-search pages.
So, to repeat for others, the "Facets block" can be used as a trigger for all of the facets from your search page to appear on any other non-search page, like this:
Filter criteria: Search: Fulltext search (exposed)andPath: /adv-searchBlock settings, setBlock nameto "Facets block" and theSearch page pathin your new "Facets block" to point to your search page, which in this example is "adv-search" (note the missing slash in front)Facet fieldto "Title" or another field, otherwise nothing will happenStructure > Blocksand put the "Facets block" right before your other "Facet API: Search service: ..." blocks. Verify that it works by going to the front page for example, and refreshNow, since the "Facets block" is only used as a trigger for the other facets, you want to hide it: Set the Views "Facets block"
Block settings > Hide blockto "Yes", so that a search will be triggered but not shown, exposing the facets.If you want to show the facets only on the front page, go to
Structure > Blocks > Facets block > configure > Show block on specific pages > Only the listed pagesand enter<front>, like you would any other block.Comment #9
nasia123 commentedI am having a small issues with this...
I have created a non search page and the facets are displaying according to the instructions provided here.
But when I click on a filter I get to the search page which I have provide in the view settings but no search is performed, while the path is like this
my-search-page?f[0]=type%3my-keyword
I am missing some other setting?
Comment #10
drunken monkeyDid you maybe set the keywords field ("Search: Fulltext search") or some other exposed filter to "Required"? Is a search executed when you go to the same page without the
?f[0]=type%3my-keywordsuffix?Comment #11
nasia123 commentedyes I had the exposed filter set to required.
thanks for the help!
Comment #12
drunken monkeyNo problem.