#1017836: D7 branch: fix empty search behavior was fixed a while ago but it seems to have regressed.

I cannot get the "Show enabled filters' blocks in their configured regions" to work.
Whenever I have no search terms I get all content listed.

For the option to work it expects the $conditions variable to be empty and it never is.

This patch fixes it for me but I haven't had a chance to check for implications on anything else so for all I know it is a terrible solution.

CommentFileSizeAuthor
apachesolr-empty_search.patch1.16 KBrooby

Comments

nick_vh’s picture

Status: Needs review » Needs work

Hmmm,

We should identify the root of these problems first. Are you having this with a clean install of apachesolr and facetapi? Can you tell us what the condition of your site is? Before fixing something like this we really need to know why it is causing this

rooby’s picture

It isn't just a clean install with apachesolr and facetapi but the site has only recently started production and it is still pretty bare bones aside from some a few field related modules, entityapi, media and a couple of modules like path auto and global redirect.
The site's modules are up to date except for a couple, which will be updated shortly.
Drupal 7.8
Apachesolr 7.x-1.0-beta10
Facetapi 7.x-1.0-beta7
Apachesolr attachments 7.x-1.0

I can try it out on a bare bones site shortly and see if it still happens.

Here is some information on othe setup:
Default searchers (in this the $searcher->settings variable is what is in my $conditions variable when I have an empty search page - seems like this would never be empty).

  $export = array();

  $searcher = new stdClass;
  $searcher->disabled = FALSE; /* Edit this to true to make a default searcher disabled initially */
  $searcher->api_version = 3;
  $searcher->page_id = 'core_search';
  $searcher->label = 'Core Search';
  $searcher->description = 'Core Search';
  $searcher->search_path = 'search/site';
  $searcher->page_title = 'Search Results';
  $searcher->env_id = 'solr';
  $searcher->settings = array(
    'apachesolr_search_search_type' => 'custom',
    'apachesolr_search_per_page' => '10',
    'apachesolr_search_browse' => 'blocks',
    'apachesolr_search_spellcheck' => 1,
    'apachesolr_search_not_removable' => TRUE,
    'apachesolr_search_search_box' => TRUE,
    'fq' => array(),
  );
  $export['core_search'] = $searcher;

  return $export;

Apachesolr environment

  $export = array();

  $name = new stdClass;
  $name->disabled = FALSE; /* Edit this to true to make a default name disabled initially */
  $name->api_version = 1;
  $name->env_id = 'solr';
  $name->name = 'localhost server';
  $name->url = 'http://localhost:8983/solr';
  $name->service_class = '';
  $export['solr'] = $name;

  return $export;

Let me know if there is anything else specifically that would help in identifying it.
I can give you a debug_backtrace() or something if it would be helpful.

nick_vh’s picture

Status: Needs work » Postponed

Going to postpone this until #1314406: De-duplication of the apachesolr_search_execute and apachesolr_search_user_defined_search_page is committed. It could solve your problems or not, please verify?

Thanks

pwolanin’s picture

Status: Postponed » Active
pwolanin’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

rooby’s picture

Yep, I have just got back to this and it appears to be working correctly now.