Jump to content

Prestashop 1.7.2.4 search results issue


mustang80

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
Link to comment
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 2
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 months later...
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.

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
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!

Link to comment
Share on other sites

  • 4 months later...
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?

Link to comment
Share on other sites

  • 4 weeks later...

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. 

 

 

Link to comment
Share on other sites

  • 2 months later...

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

Link to comment
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 ;)

 

 

 

Link to comment
Share on other sites

  • 1 month later...
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!

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

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

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

Link to comment
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/

Link to comment
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.

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

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

  • 3 months later...

Hello! I've put this to work, but if I search with dashes like NPE-5AC-500-ISO, this is one of my products, it doesn't find anything, but if I search for Svr Std 2016, this is a difrente product it works very well.

Edit: I'm usig presta 1.7.5

Edit2: I found out if I search PBE*5AC*500*ISO or PBE 5AC 500 ISO, or PBE.5AC.500.ISO it will find the PBE-5AC-500-ISO, can this be fixed?

Can you help fix the search with dahses please??

Edited by kalu (see edit history)
Link to comment
Share on other sites

Hello Peter, I've got the tags in all the products, and it still doesn't work, without the modified search.php, the product was found, but with dashes but lots of other products were found to, with this new search.php it works fine, finding the right products, except when using Dashes "-"

 

I Don't know what happende but suddnly it started to work :)

Edited by kalu (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

I have v.1.7.5.2 and search still doesnt work ok - after re-indexing and cleaning cache

I have an issue when I use the "-" character

When I do the following search, it shows me 9 options, but only shound show me 1 https://nsm.cl/store/busqueda?controller=search&s=hp+14-n+tecl

and is because the way the "-" is considered by the program is wrong

Does any one have an idea on how to fix this?   

Link to comment
Share on other sites

Kalu did you solve the issue with the dash symbol "-"?

I made some test and found that the dash "-" is considered as a space in the ps1.7.5 search module

so that is the modification we must found , where does the search consider the dash "-" as a space

 

Edited by nsm (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...
On 1/14/2018 at 1: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

I used search.php in ps1.7.6 and it's worjing well for me

Link to comment
Share on other sites

Thanks but it seems to do nothing more, like the usual file 😢,

i replaced the search.php in www/classes/

i emptyd the cache, and rebuild the index.

 

Nothing change, when i search a reference like "demo_6" it will list all the demo refs !

Link to comment
Share on other sites

  • 1 month later...

i have looked through this thread with multiple solutions is tried.

im using PS 1.7.4.2 

and having issues with my searching, it shows empty results in my response,
i have over 8k products, unfortunatly i was not available to download any of the files from this thread.

i have tried to rebuild indexes and messing around with the options a little but with no luck

is there a solution for this?

Link to comment
Share on other sites

  • 2 months later...
On 10/31/2019 at 10:37 PM, Leo Knudsen said:

i have looked through this thread with multiple solutions is tried.

im using PS 1.7.4.2 

and having issues with my searching, it shows empty results in my response,
i have over 8k products, unfortunatly i was not available to download any of the files from this thread.

i have tried to rebuild indexes and messing around with the options a little but with no luck

is there a solution for this?

hallo Leo Knudsen

I am experiencing the same issue: no results after searches. Although the site has been running fine for over 1 year.

I run Prestashop 1.7.3.1

I tried:

- emptied cahce

- reinitialized the search bar module

- rebuilt index.

Any suggestion to solve this?

thank you

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 2 months later...

Salve,

E' possibile avere un Search.php in grado di cercare i prodotti provenienti da tutti gli shop inseriti ? Sto facendo un sito BtoB multishop, ma non capisco perche i prodotti creati dagli shop non sono visibili nel sito principale ma solamente dal sito degli shop.

Grazie

Link to comment
Share on other sites

On 1/13/2018 at 4: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

Great...works on Prestashop 1.7.2.5

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
  • 3 months later...

salve,

cercando in rete ho trovato una soluzione in grado di aggiungere in whitelist i fields dei prodotti che vi occorrono.

Bisogna modificare la funzione prepareProductArrayForAjaxReturn() da classes/controller/ProductListingFrontController.php

aggiungendo nell array 'whitelist' i nomi dei fields che volete che vengano ritornati dalla search bar in ajax.

/**
     * Cleans the products array with only whitelisted properties.
     *
     * @param array[] $products
     *
     * @return array[] Filtered product list
     */
    protected function prepareProductArrayForAjaxReturn(array $products)
    {
        $filter = $this->get('prestashop.core.filter.front_end_object.search_result_product_collection');

        $filterQueue = $filter->getQueue();
        foreach ($filterQueue as $productSearchFilter) {
            if ($productSearchFilter instanceof PrestaShop\PrestaShop\Core\Filter\FrontEndObject\SearchResultProductFilter) {
                $productSearchFilter->whitelist(['category_name','manufacturer_name','images','unity']);
            }
        }

        return $filter->filter($products);
    }

 

  • Thanks 1
  • Confused 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
  • 3 months later...
  • 2 months later...
On 1/13/2018 at 3: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!

Running PrestaShop 1.7.8.0 and everything works great!

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
On 8/26/2021 at 12:18 AM, JavierP said:

any updates or solutions here? for 1.7.7.5 The prestashop search engine leaves much to be desired .....
especially for searches by tags it is heating my head ...

Hello, I have tried this free module and it works perfectly on P.S. 1.7.7.8:

https://bontheme.com/prestashop-modules/design-navigation/live-search-product-ajax-free-prestashop-module

Hope that helps!

Link to comment
Share on other sites

  • 3 months later...

I uploaded the file to public html/classes/search.php

I saved a copy of the old search.php

My backoffice no longer works and neither is my website

Tried restoring the old Search.php file

Still no backoffice or website back

Im now restoring the entire site from backup

 

Edited by Baalzheron (see edit history)
Link to comment
Share on other sites

  • 7 months later...

Hello,

I tested the file on both sites, I cleared the cache (site and browser) and rebuild the search index.

outils.expert -> 1.7.6.9 -> Theme Autotricks 1.0
Result : Once the Search.php file is replaced, the preview results from the theme search bar is not good but when I type "enter" or "more results", the results are not good either, they are the same. If I search "Socket SAE", I get "Socket" OR "SAE" in the preview and in the final result. It seems like if the search bar is overriding the Search.php file.

remorque.expert -> 1.7.8.7 -> Theme Autotricks 2.0
Result : Once the Search.php file is replaced, the preview from results the theme search bar is not good but when I type "enter" or "more results", the results are perfect. If I search "Aluminum fender", I get only aluminum AND fender in the results (not Aluminum OR fender). The previewed results are bad but the results are good. I'll work on this later.

If there is any developer out there willing to help to fix this, I would be very grateful.

Best regards,

Edited by lussier.claude (see edit history)
Link to comment
Share on other sites

  • 4 months later...

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