Jump to content

Forcing PrestaShop search to give a weight bonus if it encounters all words


Recommended Posts

Hi all,

 

I'm about to change PrestaShop version, but I've had this issue since the beginning, since words have weight, sometimes the most relevant result isn't on top, here is a quick example easy to understand, search for "porta talheres"

 

https://www.artimol.pt/search?controller=search&orderby=position&orderway=desc&search_query=porta+talheres&submit_search=

 

The "porta talheres" are in the third row, this happens because in the first places appear several products that have "porta" two times in their description, increasing their weight placement in the search function.

 

So, what seems to me like an easy solution, is giving a weight bonus if both/all words are found, something like this:

 

Found 1: porta talheres = 10 + 10 = 20 x 2 (bonus) = 40

Found 2: porta porta = 10 + 10 = 20

 

This bonus would place "porta talheres" on the top while using PrestaShop system, is this easy to implement? Can someone help? Attached is the search.php my site uses.

 

Thanks!

Search.zip

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...