Author Topic: Search doesn't support unicode  (Read 3679 times)

nflmerch

  • Jr. Member
  • **
  • Posts: 114
Search doesn't support unicode
« on: September 16, 2011, 23:13:14 pm »
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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: VM Search removes spaces
« Reply #1 on: September 18, 2011, 12:27:58 pm »
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

  • Jr. Member
  • **
  • Posts: 114
Re: VM Search removes spaces
« Reply #2 on: October 07, 2011, 00:39:59 am »
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

  • Beginner
  • *
  • Posts: 13
Search doesn't support unicode
« Reply #3 on: October 07, 2011, 19:18:30 pm »
Why in /administrator/components/com_virtuemart/models/product.php developers used JRequest::getWord?
JRequest::getString method is also safe.
Quote from: api.joomla.org
Fetches 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

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Search doesn't support unicode
« Reply #4 on: October 07, 2011, 21:21:34 pm »
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

  • Beginner
  • *
  • Posts: 13
Re: Search doesn't support unicode
« Reply #5 on: October 08, 2011, 06:04:48 am »
But if you need better security, than provided by joomla, you can use something like
Code: [Select]
function unicodeCleaner ($str=''){
return preg_replace('/[^\w\- ]/u','',$str);
}

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10144
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Search doesn't support unicode
« Reply #6 on: October 09, 2011, 22:45:19 pm »
I changed it to getString now.
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

  • Beginner
  • *
  • Posts: 13
Re: Search doesn't support unicode
« Reply #7 on: October 10, 2011, 09:54:40 am »
And one more. Why customfields search is inside search-keyword condition?

nflmerch

  • Jr. Member
  • **
  • Posts: 114
Re: Search doesn't support unicode
« Reply #8 on: October 21, 2011, 22:46:54 pm »
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

  • Beginner
  • *
  • Posts: 13
Re: Search doesn't support unicode
« Reply #9 on: October 22, 2011, 09:48:11 am »
/components/com_virtuemart/views/category/view.html.php : 102
Code: [Select]
$keyword = JRequest::getWord('keyword', '');to
Code: [Select]
$keyword = JRequest::getString('keyword', '');Note that JRequest::getString doesn't filter bad utf-8 symbols