Author Topic: Searching does not match for "special" characters #/- etc. in search string...  (Read 5929 times)

MarcoDings

  • Beginner
  • *
  • Posts: 8
Hi

Using Joomla 2.51 and VM 2
The search for normal strings seems to work and returns matched products
so searching for 10055501 or VA1932WM return the products with these strings in the product details ( as set up / configured )

Searching for strings such as
NK570AA#ABA
LF24MGSLBM/ZA
SGJBVG-12389

however fails even though the strings are in the product details

searching for substrings of the above ( not including # / - and possibly others ) , say:
NK570AA
LF24MGSLBM

does find the products mentioned

Since these strings represent manufacturer numbers its not logical for the customer to
try these "partials". The limitation of not beeing able to search for " # / - and possibly more"
illudes me why if report it as a BUG ..

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9412
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Hmmm this is a problem of a too strict security. Thanks for pointing out. We must find a good mix of forbidden chars and the one we just need, like #,-,_,/ . They are used a typical delimiters.
I should 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
Sorry this isn't the same problem, but the search function is limited in other ways as well.
For instance plurals do not work:
I have many Flasks in my store, but if I type in "FLASKS" it produces no results.   "FLASK" produces all results as expected.

I know I've been told already that it is not in the plans to fix that, but I can't help but point out that something so basic also seems more like a bug.

Imagine how many people go to a website and search, for example, "GREEN BAY SPAMMERS HATS"  instead of "GREEN BAY SPAMMERS HAT"..
... almost everyone in the USA!!!   ;)



Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9412
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
loool nflmerch, sorry, but ehrm, that is absolute standard. Using a search must be also learned and one of the first things I explain people using the first time things like google that it is always better to search for the root of a word and not deflected ones. Btw that is the way the big search engines make money. They invest millions of dollars in algorythm doing that. It is not possible anylonger to test it yourself, but years ago, even google was not able todo that. They started with "Search instead for", after years of showing that, it directly changed the keywords automatically. But that took some years of development. I know already that 3rd party developers write that. But be aware there exists NO generic solution. It must be adjusted to every language.
I should 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
Thanks for the explanation, I understand.   

Also, I discovered the search will find the plural if you name the category as the plural.
So for example, even if I only have one product that is a "Mug" that is in the category "Dinnerware", if I also put it in a category named "Mugs", then the search will find it if someone types in "mugs".

MarcoDings

  • Beginner
  • *
  • Posts: 8
Hmmm this is a problem of a too strict security. Thanks for pointing out. We must find a good mix of forbidden chars and the one we just need, like #,-,_,/ . They are used a typical delimiters.
Can you point me in the direction ( source files where i can patch this for myself) for the time beeing, knowing it will get solved.

MarcoDings

  • Beginner
  • *
  • Posts: 8
bump..

any progress on this issue "Searching does not match for "special" characters #/- etc. in search string..." ??

I could not find a reference in release notes to date 2.03h

Cheers Marco

rippergr

  • Jr. Member
  • **
  • Posts: 72
    • Computer World
Has anyone fixed that problem?
Visit my webpage www.comworld.gr

rippergr

  • Jr. Member
  • **
  • Posts: 72
    • Computer World
I found a solution for this problem. I changed the file config.php in /administrator/components/com_virtuemart/helpers/
in line 812
Code: [Select]
return mb_ereg_replace('[^\w'.preg_quote($custom).']', '', $source);to
Code: [Select]
return mb_ereg_replace('/[^\w'.preg_quote($custom).']/', '', $source);The problem is that virtuemart search filter all special characters and returns no results.
With this tweak it working great.
I don't know if there is any problem with security issues. Use it with your own responsibility
Visit my webpage www.comworld.gr

tampasounds

  • Beginner
  • *
  • Posts: 12
Works 2.0.10 - good hack

Jason Farmer

  • Beginner
  • *
  • Posts: 49
I found a solution for this problem. I changed the file config.php in /administrator/components/com_virtuemart/helpers/
in line 812
Code: [Select]
return mb_ereg_replace('[^\w'.preg_quote($custom).']', '', $source);to
Code: [Select]
return mb_ereg_replace('/[^\w'.preg_quote($custom).']/', '', $source);The problem is that virtuemart search filter all special characters and returns no results.
With this tweak it working great.
I don't know if there is any problem with security issues. Use it with your own responsibility


now Line 919 in  /administrator/components/com_virtuemart/helpers/config.php for vm 2.0.12b
DevelopmentProduction
VirtueMart  
2.0.12b
1.1.3
Joomla!  
2.5.6
1.5.14
Mysql 
5.5.8
5.0.51
PhP  
5.3.5
5.2.4

huntc00

  • Beginner
  • *
  • Posts: 1
Above solutions didn't work for me. After trying several option I solved this problem as followed:


I changed:

return mb_ereg_replace('[^\w'.preg_quote($custom).']', '', $source);

To:

return mb_ereg_replace('-/[^\w'.preg_quote($custom).']/-', '', $source);

Now I can use the VM search module to search for productnumbers like: A-100001

Edit: I'm using Joomla 2.5.6 and VM 2.0.12b

kittmaster

  • Jr. Member
  • **
  • Posts: 66
Above solutions didn't work for me. After trying several option I solved this problem as followed:


I changed:

return mb_ereg_replace('[^\w'.preg_quote($custom).']', '', $source);

To:

return mb_ereg_replace('-/[^\w'.preg_quote($custom).']/-', '', $source);

Now I can use the VM search module to search for productnumbers like: A-100001

Edit: I'm using Joomla 2.5.6 and VM 2.0.12b

I'm logging in to confirm that this solution worked for me also when you need to search for wildcards and want to see it in the return results without being stripped out.

The file to mod is as mentioned > /administrator/components/com_virtuemart/helpers/config.php

vixbow

  • Beginner
  • *
  • Posts: 2
Is there a way to use overrides in the Administrator folder (mentioned above) so that this hack doesn't get overwritten?

Thanks in advance!

datalabsys

  • Beginner
  • *
  • Posts: 2
  • A beginner
Searching does not match for "special" characters #/- etc. in search string...
« Reply #14 on: December 07, 2017, 00:47:33 am »
VirtueMart 3.0.18
Joomla! 3.8.2

i have exactly the same issue here and im at the latest version of VM and Joomla....and this problem is the same since version 2.... any fixes? The lines you are advising to change do not exist anymore in VM version 3.