News:

Support the VirtueMart project and become a member

Main Menu

Search doesn't support unicode

Started by nflmerch, September 16, 2011, 23:13:14 PM

Previous topic - Next topic

nflmerch

I have a new install of joomla 1.7 and the latest release of VM RC2G and that version's modules.  I installed the sample virtuemart products.

The search module removes spaces in the search string. For example, if you search for the "hand shovel" it combines the word to "handshovel" and produces no results. Same thing with the "nice saw", it changes it to "nicesaw".

I was also hoping the new virtuemart search would have the ability to search for plurals? For example, a search for "shovels" returns no results, but there are many shovels in the vm sample products.  (a search for "shovel" returns all the correct results).
Thanks

Milbo

ahh okey, the first thing is indeed interesting, this happens due security feature.

The other thing I must neglect, we are not gooogle :-)
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

nflmerch

The search removing spaces still happens in the latest version subrelease H.
Is there something I should be doing to fix this?  Or should I just be more patient until the final release?   8)

constantined

#3
Why in /administrator/components/com_virtuemart/models/product.php developers used JRequest::getWord?
JRequest::getString method is also safe.
Quote from: api.joomla.orgFetches and returns a given filtered variable. The string filter deletes 'bad' HTML code, if not overridden by the mask.

upd: unicode support is need for $keyword, not for $search.
And you're right, if($search=='true') really can be deleted.

Milbo

Thanks for the hint. Yepp, we must change it, also in the search.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

constantined

#5
But if you need better security, than provided by joomla, you can use something like
function unicodeCleaner ($str=''){
return preg_replace('/[^\w\- ]/u','',$str);
}

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

constantined

And one more. Why customfields search is inside search-keyword condition?

nflmerch

The spaces in the search problem is close to working in subrelease J.   
Now when you have spaces in the search string, the search results are correct. 
However, it still takes out the space in the search bar, after you hit search and you're on the search results page.

constantined

/components/com_virtuemart/views/category/view.html.php : 102
$keyword = JRequest::getWord('keyword', '');
to
$keyword = JRequest::getString('keyword', '');
Note that JRequest::getString doesn't filter bad utf-8 symbols