Skip to content

Add dependency to price index so we make sure the price index has run before #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

avstudnitz
Copy link
Contributor

Description form Dominic Meglic:

I have found what I believe to be a bug. It happens when new products are imported and indexes are updated by schedule. If products are new and price index has not yet run, then products will not get added into solr. The end result is that all indexes show as up to date but solr is missing them.

It happens because the price index needs to run before solr. The solution that worked for me was just adding a dependency on price index for solr index inside indexer.xml.

Here is a more detailed explanation:

https://github.com/integer-net/solr-base/blob/master/src/Solr/Indexer/ProductIndexer.php#L545: Product collection is created

https://github.com/integer-net/solr-magento2/blob/develop/main/src/Model/Indexer/ProductCollectionFactory.php#L65: Collection gets several filters, one of which adds an inner join to “catalog_product_index_price”

Because the price index was not yet updated, these new products don’t exist inside that table and the resulting query has no results. The collection is there for empty.

https://github.com/integer-net/solr-base/blob/master/src/Solr/Indexer/ProductIndexer.php#L566: Because the products were not unset they are deleted instead, but since they are new nothing happens.

@avstudnitz avstudnitz requested a review from schmengler March 4, 2019 08:36
@schmengler
Copy link
Contributor

The <dependencies> element did not exist in Magento 2.1 yet. Are we dropping 2.1 compatibility?

@avstudnitz
Copy link
Contributor Author

No we're not, I didn't know that. Good catch. Any workaround?

@schmengler
Copy link
Contributor

I don't know, but we really need it. I've ran into the same issue => #67

@schmengler
Copy link
Contributor

Closing because the followup PR is more complete

@schmengler schmengler closed this May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants