We no longer have Node search enabled under Drupal search settings -- just ApacheSOLR and Users. When a page not found occurs, the search404 page displays the message, "The page you requested does not exist. For your convenience, a search was performed using the query XXXXX."

However, there are no search results or search field. Just a white page. This happens no matter what the term, even when there are definitely results for the term.

Comments

marktfrey’s picture

StatusFileSize
new1.22 KB

This includes the no-results patch from http://drupal.org/node/1467982, as well as switching search_form's 'module' arg to the $type_search rather than 'node'. Working for me with apachesolr 7.x-1.0-beta19.

somatics’s picture

That's great. Thanks! I will try this tonight or this weekend and report back whether or not it works.

Is this patch going to be rolled into a dev release of the module?

victoriachan’s picture

Thanks for the patch.

I have tried it, and it is showing the search results now after applying the patch. However, when I then subsequently submit the search form on the search404 page, I get directed to the solr search results page with no search key and hence no search results. It seems the search key has not been sent to the search page though it is appearing in the search input box before I submit it.

Is anyone else having this problem?

Cheers,
Victoria

victoriachan’s picture

StatusFileSize
new1.7 KB

I have tweaked the patch to fix the issue I have mentioned in my comment above.

Here's the updated patch, including the changes by marktfrey and some that I have added. This works for me using Apachesolr 7.x-1.0-beta19

The changes I have made is stated below. It isn't as elegant as I would like. But because of the way that the apachesolr module is, there doesn't seem to be a more straightforward way to get the search form. If anyone knows of a better way, do tell.

    // Construct the search form.
    if ($type_search == 'apachesolr_search') {
      // Get Apachesolr search form
      module_load_include('inc', 'apachesolr_search', 'apachesolr_search.pages');
      $search_page = apachesolr_search_page_load('core_search');
      $form = drupal_get_form('apachesolr_search_custom_page_search_form', $search_page, $keys);
      // Set the action to point to the search page, otherwise form will submit to current 404 page
      $form['#action'] = '/' . $form['#search_page']->search_path . $form['#action'];
    }
    else {
      // Get the default search form
      $form = drupal_get_form('search_form', NULL, $keys, $type_search);
    }

Thanks.

zyxware’s picture

Status: Active » Fixed

@marktfrey, @victoriachan - Thanks for the patches. I have applied this in the 7.x-1.x branch. Please check it out.

Status: Fixed » Closed (fixed)

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