@@ -376,7 +376,7 @@ public function rebuildStoreProductIndex(int $storeId, array $productIds): void
376
376
$ this ->logger ->start ('Indexing ' );
377
377
try {
378
378
$ this ->logger ->start ('ok ' );
379
- $ onlyVisible = $ this ->configHelper ->includeNonVisibleProductsInIndex ();
379
+ $ onlyVisible = ! $ this ->configHelper ->includeNonVisibleProductsInIndex ($ storeId );
380
380
$ collection = $ this ->productHelper ->getProductCollectionQuery ($ storeId , $ productIds , $ onlyVisible );
381
381
$ size = $ collection ->getSize ();
382
382
if (!empty ($ productIds )) {
@@ -421,7 +421,8 @@ public function rebuildProductIndex(int $storeId, ?array $productIds, int $page,
421
421
if ($ this ->isIndexingEnabled ($ storeId ) === false ) {
422
422
return ;
423
423
}
424
- $ collection = $ this ->productHelper ->getProductCollectionQuery ($ storeId , null , $ useTmpIndex );
424
+ $ onlyVisible = !$ this ->configHelper ->includeNonVisibleProductsInIndex ($ storeId );
425
+ $ collection = $ this ->productHelper ->getProductCollectionQuery ($ storeId , null , $ onlyVisible );
425
426
$ this ->rebuildStoreProductIndexPage ($ storeId , $ collection , $ page , $ pageSize , null , $ productIds , $ useTmpIndex );
426
427
}
427
428
@@ -928,7 +929,8 @@ public function getIndexDataByStoreIds(): array
928
929
*/
929
930
protected function deleteInactiveIds ($ storeId , $ objectIds , $ indexName ): void
930
931
{
931
- $ collection = $ this ->productHelper ->getProductCollectionQuery ($ storeId , $ objectIds );
932
+ $ onlyVisible = !$ this ->configHelper ->includeNonVisibleProductsInIndex ($ storeId );
933
+ $ collection = $ this ->productHelper ->getProductCollectionQuery ($ storeId , $ objectIds , $ onlyVisible );
932
934
$ dbIds = $ collection ->getAllIds ();
933
935
$ collection = null ;
934
936
$ idsToDeleteFromAlgolia = array_diff ($ objectIds , $ dbIds );
0 commit comments