I just upgraded to RC2 and now my custom search implemented in hook_search is incorrectly submitting to search/node instead of search/mytype. I noticed the same behavior for search/user and verified the same behavior on http://drupal.org

http://drupal.org/search/user

when submitted takes me to

http://drupal.org/search/node/dldege

After the incorrect submits I can change tabs and correctly get to

http://drupal.org/search/user/dldege

which shows the correct results.

The forms on the page seem to have the correct action set but still the submit goes to search/node.

This is my first bug report for core so please let me know if you need more information.

thx.

Comments

ChrisKennedy’s picture

Status: Active » Closed (duplicate)

Thanks for the bug report. This issue is being discussed at http://drupal.org/node/102040

dldege’s picture

Sorry, I tried searching for this to make sure I wasn't duplicating and didn't find it ... Its definitely that most recent checkin as I went back to

// $Id: search.module,v 1.206 2006/12/11 16:57:42 dries Exp $

and everything works again.

thx.

dldege’s picture

I'm not sure this is the same issue as http://drupal.org/node/102040. I just upgraded to DRUPAL-5-0 and this bug is still there despiste their being a patch added for the bug in http://drupal.org/node/102040.

dldege’s picture

Status: Closed (duplicate) » Active

This seems to be a problem with the module type not being preserved during from submit.

from search_form(...)

  $form['module'] = array('#type' => 'value', '#value' => $type);

on search_form_submit() the type is 'node' always - that is it is set and == 'node' not the module the search orginated from (user, customname, etc.)

  $type = $form_values['module'] ? $form_values['module'] : 'node';

I noticed this form item has a type of 'value' which I don't know how that works yet.

I hope this is helping.

dldege’s picture

Version: 5.0-rc2 » 5.0
hickory’s picture

Getting rid of the callback argument to search_view fixes this, as was originally suggested for the other issue. It's not clear why this was taken out of the patch at http://drupal.org/node/102040#comment-177485.

drumm’s picture

Status: Active » Closed (duplicate)

A patch existing on another issue does not imply it has been committed. I think these are still duplicates.

drumm’s picture

Status: Closed (duplicate) » Needs review
StatusFileSize
new898 bytes

Actually, I'm wrong.

Here is a patch to fix this issue. The searches submit to 'search/...', while the menu item was being defined for 'search/.../key' since $_REQUEST['keys'] is set on submitting a search. The created menu item did not match the path since it was too restrictive and we fell back to the generic node search.

This patch makes the created path for the main search page instead of the overly-specific results page.

chx’s picture

Status: Needs review » Needs work

Yes but this makes impossible to bookmark a search. I willl take a look two hours from now.

drumm’s picture

Status: Needs work » Needs review

The URL sent to the browser is still the same. Only the path of the menu callback used to serve the pages changes.

chx’s picture

Right you are. The problem was that the search form submits to search/user (for example) but search_get_keys gets the keys from POST and defines only search/user/whatever+you+searched+for .Clever trick -- but still not good enough. Because if you search for node 'foo' and want to search for user 'foo' that can't happen. So, keep the original items need to be kept but the current tab needs a MENU_CALLBACK.

dww’s picture

Status: Needs review » Needs work

agreed. in 4.7.x, if you search for "foo", end up on /search/node/foo and click "users", you go to /search/users/foo which works. that's nice behavior, which the patch from #8 doesn't retain (although at least it lets you search for users at all). ;)

dww’s picture

Status: Needs work » Needs review
StatusFileSize
new1009 bytes

after much consultation with chx, we decided drupal_goto() is the only solution. if you make a MENU_CALLBACK at, e.g. /search/node, then that destroys all the tabs we just tried to register to at search/*/$keys. :(

dww’s picture

Assigned: Unassigned » dww
StatusFileSize
new1.33 KB

new patch with some comments about the weird drupal_goto() in search_menu().

drumm’s picture

Status: Needs review » Reviewed & tested by the community

Tested and it works for me.

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 5.x

dldege’s picture

Yes, this is fixed for me - THANKS!

dldege’s picture

Status: Fixed » Active

Sorry - this fixes the redirect but breaks advanced search as well as my own custom search form items that I add on search/mymodule. The keys created by the custom form stuff is lost.

drumm’s picture

Status: Active » Fixed

A patch was committed to fix advanced search.

Anonymous’s picture

Status: Fixed » Closed (fixed)