Problem/Motivation

I want to display my search facets on every page of my website, so I went to the the facet configuration and enabled the "Display Facets on non-search page" checkbox.

As a path I entered * since my pages are all at the root of the website.

It seems like there's some kind of conflict somewhere as when I do this the search will ALWAYS retun empty result, whatever I choose (facets) or search.

When I only enter it works great.

I believe that you should use the same kind of pages selection as Blocks :

- Display only on selected pages
- Display on everypage except the selected ones

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Growiel’s picture

Still a problem as of the last version of the dev build.

Anybody as pointers how to fix this ? I really need it for a project, it's blocking for me.

jantoine’s picture

I am also seeing this issue with both the 7.x-1.x and 6.x-3.x branches. I noticed that with the 6.x-3.x branch, the issue goes away if I leave the "Submit Search block requests to this page" set to use Drupal's derfault search page. As soon as I set it to an Apache-Solr search page, the issue comes back (no results).

jantoine’s picture

The problem boils down to the caching of the empty search query. This empty query is what allows facets to show up on non-search pages. When you visit a search page, the empty query has already been run and cached resulting in no results being sent to the search page results.

Attached is a patch for the 6.x-3.x branch that prevents the empty search query from running when on the default search page.

jantoine’s picture

Component: User interface » Code
Status: Active » Needs review
FileSize
754 bytes

Same patch in #3, but for the 7.x-1.x branch.

jantoine’s picture

pwolanin’s picture

FileSize
1.97 KB

I found a couple other needed fixes as well. The query was often running 2x.

it would run 2x if the path had no alias, and would also run 2x if the aliased and non-aliased path has a common prefix that matched the filter.

pwolanin’s picture

Status: Needs review » Fixed
FileSize
1.96 KB

committed the above to 7.x, committed the attached patch to 6.x-3.x

jantoine’s picture

Priority: Major » Critical
Status: Fixed » Needs review
FileSize
556 bytes

Patch in #7 introduces PHP error trying to call the D7 current_path() function in a D6 environment. Attached patch fixes this.

wonder95’s picture

Priority: Critical » Major
Status: Needs review » Fixed

There is a problem with the patch in #7 above, in that it relies on the current_path() function, and that is a D7 only function. This was already fixed back at #1547672: apachesolr_search.module - line 27 - current_path should be replaced with $_GET['q'].

pwolanin’s picture

Fixed that in 6.x, sorry for the editing fail

Status: Fixed » Closed (fixed)

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