Jump to content

Search Doesn't Work - Multistore Not Indexing Products


antonio9357

Recommended Posts

Hi guys!

 

I'm having an annoying issue with blocksearch and multistore.

 

Everything is running on:

PS Version is 1.6.0.11

PHP 5.5.32

MySQL 5.1.73

Blocksearch is up to date

 

The problem is that blocksearch works great on shop 1 only. In every other shops, every search gives no results, with ajax and even with submit.

 

In Settings > Search

 

Indexing is activated

Ajax is activated

Minimum word length is 3

 

I tried several times to rebuild the entire index, with all shops and even with every single store. Nothing works.

 

I've looked on database and found something interesting: in table xx_search_word, prestashop inserts words with id_shop 1 only (see screenshot).

As you can see in my screenshot, the query is ordered by id_shop DESC.

 

This is definitely the problem, but I can't figure out WHY!

 

Do I forgot any setting? Or should I search for a code issue somewhere?

Thanks in advance.

post-752988-0-63149400-1456312780_thumb.png

Link to comment
Share on other sites

Indexation is done by the function indexation() in the file \classes\Search.php.

 

If you understand a bit about coding you could search there what is going wrong.

 

The problem is not really the search, but the words in xx_search_words.

 

As I said, when I rebuild the index, id creates it for shop 1 only. With shop 1 works great!

 

I can't understand why it doesn't build the index for all shops.

 

Anyway, I've looked on search.php again, but I can't see anything that can create this issue...

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

You make it hard to explain something to you.

 

The crucial line in that function is 

while (($products = Search::getProductsToIndex(

As this function getProductsToIndex() has no filter on languages or shops it may produce more than one record for a product. So if you have product that is sold in two shops and three languages it should return 6 records for that products - and you should also find 6 records for it in the ps_product_lang table. 

 

In the rest of the indexation the results of this query are stored in the ps_search_word table. 

 

So the crucial thing to find out is how many records getProductsToIndex() returns per product and why.

Link to comment
Share on other sites

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