Jump to content
mustang80

Prestashop 1.7.2.4 search results issue

Recommended Posts

I use Prestashop 1.7.2.4. When searching for certain words, it produces a lot of results, even when searching for exact phrases and product sentences, it produces hundreds of unnecessary results (version 1.7.1.2 did not have this problem). To bypass a problem I changed the class /Search.php with old version. at the same time does not show the product category in the search box as it was in version 1.7.1.2 ... .. For snippets I will upload photos

 

https://hoptuning.bg

presta.png

presta2.png

  • Like 1

Share this post


Link to post
Share on other sites

I don't like that search module either. It searches in many columns from product and category tables. This produces a lot of results. In addition, PS shows first the category in the results list, the searched word being often not present in the list, giving the impression that the search is wrong. Now, we're used to Google search which is incredibly clever in guessing what we meant...

When I have time, I plan to write my own search module. I let you know ;).

  • Like 1

Share this post


Link to post
Share on other sites

Hi Mustang80,

We are also on PS 1.7.2.4 and had the same problem. 


With help of  tips at https://www.prestashop.com/forums/topic/597944-search-two-or-more-words/?tab=comments#comment-2631092

we modified the file classes/seach.php.  This solved the problem in our site. Seach is getting exact results now.

Attached the modified search.php file.  Rename the file to search.php and upload to your server.

Best regards,

Peter

PS-1.7.2-modified-for-or_Search.php

  • Like 6
  • Thanks 1

Share this post


Link to post
Share on other sites
On 2018/1/13 at 10:10 PM, peter-D said:

Hi Mustang80,

We are also on PS 1.7.2.4 and had the same problem. 


With help of  tips at https://www.prestashop.com/forums/topic/597944-search-two-or-more-words/?tab=comments#comment-2631092

we modified the file classes/seach.php.  This solved the problem in our site. Seach is getting exact results now.

Attached the modified search.php file.  Rename the file to search.php and upload to your server.

Best regards,

Peter

PS-1.7.2-modified-for-or_Search.php

it's working for me, i use 1.7.2.2, Tks brother.

Share this post


Link to post
Share on other sites

Fix is working for 1.7.3.0 as well

Thank you so much Peter-d!!!

Share this post


Link to post
Share on other sites
On 1/13/2018 at 6:10 AM, peter-D said:

Hi Mustang80,

We are also on PS 1.7.2.4 and had the same problem. 


With help of  tips at https://www.prestashop.com/forums/topic/597944-search-two-or-more-words/?tab=comments#comment-2631092

we modified the file classes/seach.php.  This solved the problem in our site. Seach is getting exact results now.

Attached the modified search.php file.  Rename the file to search.php and upload to your server.

Best regards,

Peter

PS-1.7.2-modified-for-or_Search.php

 

This is a great help! Thank you so much!

Share this post


Link to post
Share on other sites
On 27/8/2018 at 10:55 AM, BonPresta said:

 

 

On 25/9/2018 at 3:47 PM, cswebsolution said:

!

 

On 28/12/2017 at 10:04 AM, Pierre_d said:

I don't like that search module either. It searches in many columns from product and category tables. This produces a lot of results. In addition, PS shows first the category in the results list, the searched word being often not present in the list, giving the impression that the search is wrong. Now, we're used to Google search which is incredibly clever in guessing what we meant...

When I have time, I plan to write my own search module. I let you know ;).

 

I hope that you develope a module search ad hoc. How you use Google search in Prestashop?

Share this post


Link to post
Share on other sites

Hi dear, the search of ps 1.7.4 is still as bad as you find in 1.7.3,1.7.2 , completely unusable. Your search.php can work on 1.7.4? The goal is simply to use a AND LOGIC instead OR in the query result. 

 

If you have server when can install package you must consider install elastich searche module. I use that and it work GREAT. 

 

I've found another trick to tune up 1.7.4 search. The big problem on the defaul class is that it use an OR operator,so you get lot of result but also you get higher rank on products that has duplicated word in their field. Using or instead and your result don't match the query you are searching. If you try to find "Z H" you will have a higher result for entry with

"Z Z Z"

than one with 

"Z H A"

 

And this is Creasy. To mitigate this function we have installed a module "auto keyword generator" and we configure it for generate tags from short desc. The module REMOVE duplicate entry and we teach search to use title and tags instead short desc . In title is hard to find duplicated words, instead in short desc it can happen frequently. 

 

 

Share this post


Link to post
Share on other sites

Hi Guys! I was searching for solutions around the web but there is nothing helpfull. This topic seems to be the only solution in the internet but sadly file to download no exist...

Can anyone who already downloaded file share it again here? 

Would be gratefull for any answear!

Cheers

Share this post


Link to post
Share on other sites
Posted (edited)

Prestashop is the bad think i've ever seen.

 

Try the attached one or think over a wonderful doofinder integration. 

 

If you need help we can setup elastich search or doofinder plugin for you. thanks

classes.rar

 

Replace the 1.7.2 / 1.7.3 / 1.7.4 with the 1.7.1

Edited by Matteo

Share this post


Link to post
Share on other sites

Thanks, I tried both files but nothing changed. Also tried to use search from prestashop 1.6 but it also no work for me.

My problem is that if I have items like: move sensor, sound sensor, temperature sensor, humidity sensor

and Im searching: "move sensor"

presta shows:

1) humidity sensor,

2) temperature sensor,

3) move sensor 

phrase "move sensor" is at the very end.

It will be best if it shows only items with both words"move" and "sensor" in product name, or even showing all stuff with words "sensor" and "move" would be ok but only items with both words will be on the very top of search list...

 

Maybe there is solutions with chamge operators AND and OR is search query? I looked in to the code but there is nothing clear to me ;)

 

 

 

Share this post


Link to post
Share on other sites
On 1/13/2018 at 2:10 PM, peter-D said:

Hi Mustang80,

We are also on PS 1.7.2.4 and had the same problem. 


With help of  tips at https://www.prestashop.com/forums/topic/597944-search-two-or-more-words/?tab=comments#comment-2631092

we modified the file classes/seach.php.  This solved the problem in our site. Seach is getting exact results now.

Attached the modified search.php file.  Rename the file to search.php and upload to your server.

Best regards,

Peter

PS-1.7.2-modified-for-or_Search.php

Thank you very much for your help. I was just hitting the limit to switch to another CMS because of this problem. If you are in Bulgaria or visit us at some point, you just earned a several pints of beer!

Share this post


Link to post
Share on other sites

Thank you peter-D!
Made suitable for override.
Insert Attachment to: override/classes/Search.php
tested on 1.7.5

Search.php

Share this post


Link to post
Share on other sites
Posted (edited)
On 2/25/2019 at 8:50 AM, T74 said:

Thank you peter-D!
Made suitable for override.
Insert Attachment to: override/classes/Search.php
tested on 1.7.5

Search.php

1.7.5.1 Not working, can You Fix it?

RM7Ei9.jpg

Edited by Inkton

Share this post


Link to post
Share on other sites

Hi Inkton,

We are also on Prestashop 1.7.5.1 and search is working perfect.
Based on Bolean seach AND function, will find products which have all the words visitor did add in the search field. i.e. "love" AND "hate" AND "relation". 

Further in admin  under 'settings/search'  you can adjust the weight (value) you put into search (title, discription, tags) and also
search "in a word" or not
and search for exact  word end.

Select and test what gives the best results.
On our site, we found best result with setting :  "search in the word" =  off and "seach for exact end " on.

You can see how it works on our site, visit www.derks-wielersport.nl.
Search for "ketting" 142 hits).
Then seach for "ketting" and " 11" (35 hits),
Then search for "ketting" and '11" and "KMC" (17 hits),



Greetz,

Peter

Share this post


Link to post
Share on other sites
15 minutes ago, peter4661 said:

Hi Inkton,

We are also on Prestashop 1.7.5.1 and search is working perfect.
Based on Bolean seach AND function, will find products which have all the words visitor did add in the search field. i.e. "love" AND "hate" AND "relation". 

Further in admin  under 'settings/search'  you can adjust the weight (value) you put into search (title, discription, tags) and also
search "in a word" or not
and search for exact  word end.

Select and test what gives the best results.
On our site, we found best result with setting :  "search in the word" =  off and "seach for exact end " on.

You can see how it works on our site, visit www.derks-wielersport.nl.
Search for "ketting" 142 hits).
Then seach for "ketting" and " 11" (35 hits),
Then search for "ketting" and '11" and "KMC" (17 hits),



Greetz,

Peter

It's not about whether it works or not just what I'm showing. I joined screen. What I would not typed shows me something like that

Share this post


Link to post
Share on other sites

I attached the working file from our site. "search-PHP modified".

You need to rename the file to search.php.
 

Make sure to clear all your cache file after installation of the new search file and re-index ( admin : settings/search )

 

Search_PHP modified.php

Share this post


Link to post
Share on other sites
42 minutes ago, peter4661 said:

I attached the working file from our site. "search-PHP modified".

You need to rename the file to search.php.
 

Make sure to clear all your cache file after installation of the new search file and re-index ( admin : settings/search )

 

Search_PHP modified.php

Ok, now he does not make any mistakes. I have not rebuilt the index before. But I have a question, why can not I find some things? For example, I have a product with the title "Byzantine table from teak wood". I would like to start displaying this subject to me after entering "Byz", but it does not work until I type in the whole word. I have so many objects and for now I do everything manually adding aliases, but this is not a solution. Does anyone know why this is so?

https://shekina.eu/en/

Share this post


Link to post
Share on other sites

For getting search results while you type,  disable setting "search for exact end" , under settings/seach. 

See if this gives you the desired results in combination with "search in word" (on/off)

Share this post


Link to post
Share on other sites
8 minutes ago, peter4661 said:

For getting search results while you type,  disable setting "search for exact end" , under settings/seach. 

See if this gives you the desired results in combination with "search in word" (on/off)

Finally, thank you, it was so easy. Life saver.

Share this post


Link to post
Share on other sites
On 14/3/2019 at 13:43, peter4661 said:

Ho allegato il file di lavoro dal nostro sito. "search-PHP modified".

È necessario rinominare il file in search.php.
 

Assicurati di cancellare tutto il tuo file di cache dopo l'installazione del nuovo file di ricerca e reindicizzare (admin: settings / search)

 

Search_PHP modified.php

Buongiorno,

utilizzo la versione 1.7.4.4. Sul nostro sito i clienti hanno prezzi diversi a seconda del gruppo a cui appartengono. Chi non è loggato non visualizza alcun prezzo, se, però, effettua una ricerca inserendo una descrizione o un codice escono i risultati con anche l'indicazione del prezzo. Come posso risolvere il problema? Allego screenshot. Grazie in anticipo, Andrea

Schermata_2019-03-19_alle_10_40_44.png

Share this post


Link to post
Share on other sites

Hi, thanks for the solutions. I am close to solve it with the Search_PHP modified.php in PS 1.7.4.4 but I have found an error when I search 2 words or only one of them. Because I got bad results. Example: I search AEROCHARGE and I get 9 products with the name HUMMEL AEROCHARGE but when I search HUMMEL AEROCHARGE....I get only 3 product with the name HUMMEL AEROCHARGE. Must show the same 9 products.

Any help?

thanks

Share this post


Link to post
Share on other sites
Posted (edited)
On 2/25/2019 at 10:50 AM, T74 said:

Thank you peter-D!
Made suitable for override.
Insert Attachment to: override/classes/Search.php
tested on 1.7.5

Search.php

@T74

I don't see any existing file in the root/overrides/classes by the name of Search.php. So I made one file on my own and the search still show same result.

Do I need to recompile or rebuild something?

I am new to Php & Prestashop, so not sure how things work.

Using Prestashop 1.75.1
image.png.591050dded4fc2a0febd98a2a22956ea.png

Regards,

Hitin

Edited by hitin

Share this post


Link to post
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

×

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More