这个部分进行了优化,需要添加一定的索引。
@fecshop\models\mongodb\Product.php
更改索引:
public static function create_index()
{
$indexs = [
['spu' => -1],
['sku' => -1],
['category' => -1,'score' => 1],
['category' => -1,'review_count' => 1],
['category' => -1,'favorite_count' => 1],
['category' => -1,'created_at' => 1],
['category' => -1,'final_price' => 1],
];
$options = ['background' => true];
foreach ($indexs as $columns) {
self::getCollection()->createIndex($columns, $options);
}
}
新版本会更新上去。