Using the search block to look up, for example, the word 'hello' (no single quotes) the url gets composed as http://www.example.com/en/search/node#keys%20hello

Once the search page comes up, it has in the search box '20hello' (no quotes) and the url
becomes http://www.example.com/en/search/node#keys%2020hello
This makes the search fail. if from the search page I remove the preceding '20' then the search runs fine.

Other than that, great module!

Comments

ilroby’s picture

Forgot to add, this happens with IE (7 and I think 6 as well), seems ok with Firefox.

nedjo’s picture

Thanks for the note. It's a case of the forward slash getting escaped. More generally, it's a limited/poor implementation of 'hijax' (updating history with AJAX state changes).

The best solution likely is to use the enhanced history plugin that's now part of Javascript Tools instead of the custom approach used here.

manimal’s picture

yes, this also happens in safari for windows and osx.

I'm not sure what you mean about using the enhanced history? is this a setting? (sorry I'm sorta new)

manimal’s picture

nevermind.. found the dev release..(haven't slept in awhile)

somatics’s picture

This is still happening for me. I have Drupal 5.2 on a Mac OS X 10.4 server with JS Tools and all associated modules installed. It's the latest version of JS Tools (5.0.8). I need to fix this soon, as we launch our site in 24 hours!

somatics’s picture

I just installed the HEAD and tried it again -- still the same problem.

nedjo’s picture

I'm not sure what you mean about using the enhanced history?

What I mean is that the Javascript needs to be rewritten. Currently it uses its own way of appending history to the URL. Evidently this fails in IE. One option would be to try to fix this in IE. But it would be better to remove the custom implementation and instead use the jQuery history plugin, which provides a much better solution.

nedjo’s picture

Status: Active » Fixed

Fixed in HEAD and DRUPAL-5 (5.x dev) branch.

Replaced space character with =, which doesn't get escaped.

jwilde’s picture

Hi nedjo,

Thank you for all of the hard work. Active search works great. jim

somatics’s picture

Yes, I installed the HEAD version (I didn't know where else to find the dev version) and it fixed virtually ALL the Javascript problems I was having -- the very same search problem reported here, the inability to re-order items in Interface Sortable, and -- most of all -- a "fatal" problem with the checkout process in UberCart. These were all present only on Safari not on FireFox with jstools 5.x-0.8 and now with the latest HEAD version that was fixed yesterday, they're gone. Thank you!!

jwilde’s picture

I'm still having the problem somewhat in IE. For example, if I search for, 'the long tail', this is what shows up, 'the%20long%20tail', in the search form box.

Best jim

nedjo’s picture

k, thanks for the report. /me is beginning to regret ever coding this module. I suppose we need to substitute + for spaces in the string passed by the javascript. I'd welcome a patch.

drupalina’s picture

Status: Fixed » Active

Subscribing.

I have the same problem: 20 appears before and %20 appears between the searck terms. It'd be great to have a solution for this ASAP.

bobdalob’s picture

Subscribing. Tried in latest dev release & 5.x-0.8, same problem. Okay in FF & Opera

pictogram’s picture

Subscribing, but I can't help here, sorry.

missym’s picture

subscribing - same issue

Only an issue when Active Search is on

adam-s’s picture

Just ran into this problem on a site. A quick hack if you're not quite ready for upgrade...

Go to modules/search/search.module

In the search_query_insert function just before lines 634-635...

  return $keys;
}

Add the following code...

if (substr($keys, 0 ,2)=='20') $keys=substr($keys, 2);

So it looks like...

function search_query_insert($keys, $option, $value = '') {
  if (search_query_extract($keys, $option)) {
    $keys = trim(preg_replace('/(^| )'. $option .':[^ ]*/i', '', $keys));
  }
  if ($value != '') {
    $keys .= ' '. $option .':'. $value;
  }
  if (substr($keys, 0 ,2)=='20') $keys=substr($keys, 2);
  return $keys;
}

Not even close to a perfect or ideal solution but if you need a quick fix maybe this will help...

Lityi’s picture

thx, it works as a quick fix ;)

adam-s’s picture

Looks like this may not work for Safari users.

yas’s picture

Subscribing.

westwesterson’s picture

Priority: Normal » Critical

this totally breaks search in the safari browser! v 3.1 The page keeps getting refreshed and fills the search box with 20s.

somatics’s picture

I am having these same problems in Safari 3 or 3.1 with Javascript Tools that I used to have before I upgraded the module last Fall, but now it happens no matter how recent a version I use.

Does anyone know what the fix is? It is messing up my shopping cart functionality, and I am losing customers rapidly.

westwesterson’s picture

I can confirm my problems with thie have ended with the latest release.

bobdalob’s picture

It still causes problems (as described in #21) with safari (windows), in an advanced search performed with more than one word.

Note: the %20 issue occurs regardless of simple/advanced, when using more than one search term.

nedjo’s picture

Status: Active » Fixed

Safari issue addressed by not applying Activesearch under Safari. See http://drupal.org/node/192910#comment-806695.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

timefor’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

was this ever fixed?

ekendra’s picture

in activesearch.js change the function starting on line 29 to:

Drupal.activesearchSubmit = function() {
  var nastyChars = eval("/%20|#/ig");
  $('#edit-keys').attr('value', location.hash.substring(6).replace(nastyChars, ' '));
  // Call the submit event.
  $('#search-form').submit();
  // Actually submit the form.
  $('#search-form')[0].submit();
};

seems to do the trick although I'm sure there's a more elegant solution

quineto’s picture

hello ekendra

this code only replaces the first 20 in the first term, does it york for you for more than one term?

Drupal.activesearchSubmit = function() {
  var nastyChars = eval("/%20|#/ig");
  $('#edit-keys').attr('value', location.hash.substring(6).replace(nastyChars, ' '));
  // Call the submit event.
  $('#search-form').submit();
  // Actually submit the form.
  $('#search-form')[0].submit();
};
quineto’s picture

Hello Lityi,

Did this fix worked for more than one term in the search box?

thanks

goudal’s picture

It does not work when there is a accentued character...