Jump to content

Edit History

ukyoner

ukyoner

On 4/6/2020 at 6:34 PM, hakeryk2 said:

Hello devs and users,

I was strugling with this really bad behavior of Prestashop search engine when ie: you were searching for "wooden chair" and You end up with result of products that contains "wooden" and "chair" as well. Which sucks ass.

This was driving my crazy so I end up with this override for Search.php in Prestashop 1.6 - didn't tested this on 1.7. This piece of code checks whether product that You searched for contains both or more words in search index (like tags, featuers not only the name) that You actually searched. Now I can die peacefully because when somone was searching for ie: Black chair he don't ends up with bunch of black wardrobes, chairs, sofas etc but actually only black chairs.

To get this working at least in a relevant way please use at least (product name, features, categories, tags) or combinations set in Preferences -> Search. After this rebuild Your cache. Try not to use description or short description because it contains to many words.

To install this just put this file in override/classes/ and after this remove class_index.php file in cache folder.

I hope You find it usefull. I was working on this for 6 hours because I had to understand how prestashop search engine works (by the way - why the f*** presta needs to get all products from shop before searching!?) and I had to do this as efficient and performative as I can so any tip will be appreciated. It works faster for me then previous one. Try it for yourself :) If someone will find a better way to do this after reading this code please share it as well.

I need to edit the file because previous contained a lot of my own overrides to search categories, cms and other stuff as well - now it's a clean one :)
Update: I found much more efficient and easier method to get this done :) Edited again.

 

 

 

Search.php 9.03 kB · 35 downloads

[edit]

i have an error 500 with 1.61.13

ukyoner

ukyoner

On 4/6/2020 at 6:34 PM, hakeryk2 said:

Hello devs and users,

I was strugling with this really bad behavior of Prestashop search engine when ie: you were searching for "wooden chair" and You end up with result of products that contains "wooden" and "chair" as well. Which sucks ass.

This was driving my crazy so I end up with this override for Search.php in Prestashop 1.6 - didn't tested this on 1.7. This piece of code checks whether product that You searched for contains both or more words in search index (like tags, featuers not only the name) that You actually searched. Now I can die peacefully because when somone was searching for ie: Black chair he don't ends up with bunch of black wardrobes, chairs, sofas etc but actually only black chairs.

To get this working at least in a relevant way please use at least (product name, features, categories, tags) or combinations set in Preferences -> Search. After this rebuild Your cache. Try not to use description or short description because it contains to many words.

To install this just put this file in override/classes/ and after this remove class_index.php file in cache folder.

I hope You find it usefull. I was working on this for 6 hours because I had to understand how prestashop search engine works (by the way - why the f*** presta needs to get all products from shop before searching!?) and I had to do this as efficient and performative as I can so any tip will be appreciated. It works faster for me then previous one. Try it for yourself :) If someone will find a better way to do this after reading this code please share it as well.

I need to edit the file because previous contained a lot of my own overrides to search categories, cms and other stuff as well - now it's a clean one :)
Update: I found much more efficient and easier method to get this done :) Edited again.

 

 

 

Search.php 9.03 kB · 35 downloads

[edit]

you can delete my post it's a mistake

ukyoner

ukyoner

On 4/6/2020 at 6:34 PM, hakeryk2 said:

Hello devs and users,

I was strugling with this really bad behavior of Prestashop search engine when ie: you were searching for "wooden chair" and You end up with result of products that contains "wooden" and "chair" as well. Which sucks ass.

This was driving my crazy so I end up with this override for Search.php in Prestashop 1.6 - didn't tested this on 1.7. This piece of code checks whether product that You searched for contains both or more words in search index (like tags, featuers not only the name) that You actually searched. Now I can die peacefully because when somone was searching for ie: Black chair he don't ends up with bunch of black wardrobes, chairs, sofas etc but actually only black chairs.

To get this working at least in a relevant way please use at least (product name, features, categories, tags) or combinations set in Preferences -> Search. After this rebuild Your cache. Try not to use description or short description because it contains to many words.

To install this just put this file in override/classes/ and after this remove class_index.php file in cache folder.

I hope You find it usefull. I was working on this for 6 hours because I had to understand how prestashop search engine works (by the way - why the f*** presta needs to get all products from shop before searching!?) and I had to do this as efficient and performative as I can so any tip will be appreciated. It works faster for me then previous one. Try it for yourself :) If someone will find a better way to do this after reading this code please share it as well.

I need to edit the file because previous contained a lot of my own overrides to search categories, cms and other stuff as well - now it's a clean one :)
Update: I found much more efficient and easier method to get this done :) Edited again.

 

 

 

Search.php 9.03 kB · 35 downloads

Hello,

the file link is no longer aivable,

can you send me please ?

×
×
  • Create New...