When on a 404 page, searching using a search box somewhere on the page returns another 404 page instead of search results.

Looks like this is the same issue as on http://drupal.org/node/292565. The same fix works for Apache Solr's apachesolr_search_search_box_form_submit().

Patch against 6.x-1.x-dev. I included the documentation from the fix on http://drupal.org/node/292565 as well.

Comments

brunodbo’s picture

StatusFileSize
new903 bytes

Patch attached.

robertdouglass’s picture

So this patch appears to just be keeping apachesolr in sync with core: http://drupal.org/files/issues/search_404-force-destination.d6_0.patch

slip’s picture

Status: Needs review » Reviewed & tested by the community

I'm using 1.0 and cam across this problem/patch and it fixed the problem. Seems to make sense given comment #2.

robertdouglass’s picture

+++ apachesolr_search.module.new	2009-12-02 16:27:30.392157999 +0100
@@ -760,6 +760,16 @@ function apachesolr_search_form_search_b
+  if (isset($_REQUEST['edit']['destination'])) {
+    unset($_REQUEST['edit']['destination']);

Can you confirm that this line is really needed? unset($_REQUEST['edit']['destination']);

Our case isn't as general as Drupal core's.

Powered by Dreditor.

robertdouglass’s picture

Status: Reviewed & tested by the community » Needs review
slip’s picture

StatusFileSize
new1.12 KB

I actually haven't been able to figure out the point of those lines at this point. So if somebody wants to clue me in there I'd be able to answer that question better.

However, I read the thread referenced in the comment and I think I understand all of the issues. I removed those lines and did the d6 version of the testing outlined in comment #115, and everything worked. So, if that's adequate, I'm attaching a patch to today's 6.x-1.x-dev branch with those lines removed for review.

robertdouglass’s picture

Status: Needs review » Patch (to be ported)

#649038 by brunodbo, slip | robertDouglass: Fixed Search not working on 404 page.

Committed to 6.x-2.x, thanks.

geerlingguy’s picture

Subscribe.

jpmckinney’s picture

With regard to $_REQUEST['edit']['destination'], the docs for drupal_goto explain:

 * Usually the redirected URL is constructed from this function's input
 * parameters. However you may override that behavior by setting a
 * destination in either the $_REQUEST-array (i.e. by using
 * the query string of an URI) or the $_REQUEST['edit']-array (i.e. by
 * using a hidden form field).
jpmckinney’s picture

Version: 6.x-1.x-dev » 5.x-2.x-dev
StatusFileSize
new1.28 KB

Updated 6-2 with the extra unset(). http://drupal.org/cvs?commit=361748

Fixed in 6-1. http://drupal.org/cvs?commit=361744

I'm a little surprised the current 5-2 search box form is working. According to search_box_form_submit, they keys are in $form_values[$form_id .'_keys'], but the 5-2 code looks for them in $form_values[$form_id]. Here is the 5-2 patch.

jpmckinney’s picture

Status: Patch (to be ported) » Fixed

Fixed the $form_values[$form_id .'_keys'] issue in #708414: Fix incorrect usage of D5 FAPI. Committed the rest to 5-2. http://drupal.org/cvs?commit=361766

Status: Fixed » Closed (fixed)

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