Search error when the field contains spaces
javieras - December 18, 2008 - 12:30
| Project: | Profile search |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hi.
I've noticed that if you search writing a text with spaces it doesn't find anything. I've looked the code and found that:
function profilesearch_search_form_submit($form_id, $form_values) {
$searchstring = str_replace(" ", "+", $form_values['search']);
return 'profilesearch/'. $searchstring;
}
If you use "$searchstring = str_replace(" ", " ", $form_values['search']);" instead, it works fine. It's like doing nothing. Is there a reason why it is used the replacing?
Bye! And thanks in advance!

#1
The replacement there modeled on search.module, and I think is from the original code. There's probably a better way of doing it, to be honest. :-) Patches welcome.
#2
Thanks. I've deleted this line "$searchstring = str_replace(" ", "+", $form_values['search']);" till i have time to see another way to do it.
Bye!