Jump to content

Search (Drupal) Preg_class_exclud for forward slash "/"


eec

Recommended Posts

Hi

 

we have product names with "/" and "-" in them (the name has got forward slash in it). I did study the search engine behavior and code and could overwrite the search.php to let me handle the "-" differently and now dash-esh are ok.

 

But appears that forward slashes are making the search string explode, which in our case is not good. I cannot properly search products with "/" in their names.

 

Do you know how can I fix this issue? I need the search not to do anything with slashes and only treat forward slash like any other alphabet or character.

 

Thanks!

Link to comment
Share on other sites

Hello Pascal

 

I need to fix this in the search module. but apparently before I can touch the phrase it is getting exploded because of "/" delimiter. How can I stop the search module from changing the search phrase because of "/".

 

I noticed in search.php comments they have removed \x{d} to keep the "dash" or "-" do I need to remove another \x{?} to keep the "/"? I'm not really familiar with drupal classes or how else I can escape the "/" in search phrase in the search.php

 

Thanks

Link to comment
Share on other sites

Hello

 

I managed to fix the issue and here is what I have done;

 

in Search.php where they have removed the dash \x{2d} I also removed the x{2f} which is the ASCII code for "/" (forward slash). This way the search code will consider "/" a normal character which is the case in our shop and products.

 

Then in definition of $intersect_array[] where the SQL query is being defined I handled the forward slash also the dash according to our shop's requirement.

 

Open source rocks!

 

Thanks,

 

This issue is SOLVED!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...