I have a View that is driven by a Facet Search using three facets (Region, Country and Theme). I would like to have it show no results until the user picks something from one of the Facets. Instead, it should give a message such as "Choose criteria on which to search."

Views does this for its own "exposed forms" by choosing exposed form style "input required" in the Advanced settings. However, the criteria provided by a Facet Search do not affect the Views "Exposed Form: Input Required." That is, Facet Search's own blocks are separate from the Views' exposed form blocks, and therefore do not participate in "input required" decisions.

Perhaps there is already a way to do this, but after two days of searching, I have not found it. I have tried many things, including many variations of using a "Global:Null" contextual filter.

Comments

scottop created an issue. See original summary.

eugene.ilyin’s picture

I think it can be done easy through custom code.
Simplest way consists of few steps:
1. Alter the rendering of your search results (for example through preprocess).
2. Add a logic to show a text your instead of results if facets not active.

How to detect that facets are not active?
Use this:

  // Name of your searcher.
  // In this case "search_api" is service
  // and "solr_index" is machine name of the index.
  $searcher = 'search_api@solr_index';
  $adapter = facetapi_adapter_load($searcher);

  $active_items = $adapter->getAllActiveItems();  

If active items is empty, it means that you have no active facets.

eugene.ilyin’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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