If you enter, for example, "uj" into the site search box, it will return:
"You must include at least one positive keyword with 3 characters or more."
This is fine. But any legitimate, subsequent searches (e.g. "leg") using that same site search box FROM THAT PAGE won't work, and you'll continue to get that same message above.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ezra-g’s picture

Status: Active » Postponed (maintainer needs more info)

Are you experiencing this issue with Core search or Solr-powered search?

work77’s picture

How can I tell? I just installed DC and it was one of the first things I checked. Whichever search box is at the top, just to the right of the "Events" menu button. Hope that helps.

jpontani’s picture

Assigned: Unassigned » jpontani
Status: Postponed (maintainer needs more info) » Active

I am able to reproduce using Core search. Looking into it.

jpontani’s picture

Status: Active » Needs review
FileSize
584 bytes

The issue is the search_block_form '#action' attribute points to something like '/search/content/uj' after searching, so any new search is basically searching for the same keywords every time.

Try this patch. It should remove the search keywords from the form action when using core search.

jpontani’s picture

Actually this patch. The first one doesn't take into account hitting the page without searching, and messes up the form action.

work77’s picture

Wow. That was my first time reporting a drupal issue. That was some speedy work by you guys. Thanks!

ezra-g’s picture

Issue tags: +Commons 7.x-3.4 radar

Adding to the 3.4 radar for review.

ezra-g’s picture

Status: Needs review » Fixed

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

vinmassaro’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

I came across this issue since we are seeing it happen in our sites, but we don't use Drupal Commons. I can reproduce the problem with a fresh Drupal 7 install with the out of the box search block. Can you move this issue to the D7 core issue queue? Thanks.

jcfiala’s picture

If you've found this ticket because you have the same problem with core search, this sort of a hook will fix the problem:

function example_form_search_block_form_alter(&$form, $form_state) {
  $keys = arg(2);
  if (!empty($keys)) {
    $form['#action'] = str_replace("/" . check_plain(arg(2)), '', $form['#action']);
  }
}

And yes, it's pretty much the same thing as the patch above.

serundeputy’s picture

fyi this is fixed in Drupal 7.42
https://www.drupal.org/node/2530652

So upgrade of core should solve the problem here.

cheers,
~Geoff

breinhart’s picture

Can anyone tell me where to apply the above patch? I tried several files in the modules/search directory, but I didn't have any luck. We took over a site that is running Drupal 6.20 and it's on our hosting server, and the search is the only thing that isn't working. I've researched it and tried many things but I can't get the search to work at all. I tried changing the minimum search parameter, re-indexed, (site will show 100% indexed) then I get the same result. This will eventually be switched over to a different CMS so we don't want to upgrade the core just to fix one issue. Note** the complete database was copied from the site where the site search works, but it's not working on our server for some reason. (php rolled back to 5.3 to test and same result happened) Thank you!