As mentioned in the post at #1248740: How can facet blocks be displayed on non-search pages?, facets currently can't be rendered on non-search pages. The reason is that the Facet API assumes the facets link back to the page they are on. This assumption needs to be broken in order to add this functionality.

CommentFileSizeAuthor
#2 facetapi-1252644-2.patch4.24 KBcpliakas

Comments

cpliakas’s picture

Priority: Normal » Major

Changing priority.

cpliakas’s picture

Status: Active » Needs review
StatusFileSize
new4.24 KB

Pushed the non-search-facets branch for further development of this issue. The attached is a patch was rolled against 7.x-1.x and is ready for testing. In order for the patch to work with with the Apache Solr module, that project must also be patched with the latest one available in the #1252648: Allow for enabling facet blocks on non-search pages thread.

Refineo’s picture

Status: Needs review » Reviewed & tested by the community

I patched manually both facetapi-1252644-2.patch and #1252648: Allow for enabling facet blocks on non-search pages

I got WSOD
Array
(
[type] => 4
[message] => syntax error, unexpected '}'
[file] => /***/sites/all/modules/facetapi/facetapi.module
[line] => 465
)

then I removed the unnecessary } line 465.

Refineo’s picture

Configuration set:

[X] Show facets on non-search pages.  

Non-search paths 
<front>

Saved, message appears:

"The configuration options have been saved.
 To enable or arrange the facet blocks, visit the blocks administration page."

Selected blocks:

"The block settings have been updated."

Now I can see relevant facets on the front page.
Frontpage facets work for me now. Thanks!
However, I don't see the front page Apache Solr Integration driven results to be filtered at all.
I am checking further...together with #1252648: Allow for enabling facet blocks on non-search pages

cpliakas’s picture

refineo,

Thanks for testing the patches! Much appreciated.

Regarding your use case, I think this is actually something separate. The use case here is to add facets to non-search pages so users can initialize a search form the home page or other pages. I think where you are going is adding facets to the pre-canned pages served by Solr, i.e. by taxonomy term, etc. That is actually slightly different and is more of a task for Apache Solr. Once this task is completed, I will put some thought into what it would take to get this accomplished.

Terko’s picture

Hello! Where you see this?
[X] Show facets on non-search pages.
I try to find where I can enable this option after applying the patch. I can't find it. Thanks!

Terko’s picture

I patched the Facetapi, but I am unable to build Panel with few blocks, representing facets. I want to make my front page to contain facets to searches, like this site: http://drupaljobs.epiqo.com/
When I make Facet Block view and use it in Panel, they are always empty. I am using Search API, and not using Apache SOLR module. If I try to enable Apache SOLR, it can't connect to solr server, because it's already used by Search API.
Pleace, advice! Thanks!

Update: I use Search API Solr for communication with the solr server. My other modules rely on this and I cannot change it with Apache Solr Integration. So maybe I need to patch Search API Solr (Solr Search module) to use nonsearch page facets?

cpliakas’s picture

teri@uhaaa.com,

Facet API is simply the facilitator, and it is up to the backend to actually provide the interface and the ability to add blocks to non-search pages. Apache Solr will support this when the patch at #1252648: Allow for enabling facet blocks on non-search pages is applied, but this functionality may be an issue with Search API. Check out the post at http://drupal.org/node/1263386#comment-4925742 for the reason why. I will not be working on this, so it is a great opportunity to jump in and help Thomas support this functionality in Search API.

Thanks for testing,
Chris

Terko’s picture

Thank you Chris!

drunken monkey’s picture

Works perfectly, thanks!
Using it now in my new „Facet blocks“ implementation.

cpliakas’s picture

Thanks everyone for testing! Will commit the patch in #2.

cpliakas’s picture

Status: Reviewed & tested by the community » Fixed

Committed at 4d63b0c.

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