【问题标题】:Shopware 6 - elastic search and search result pageShopware 6 - 弹性搜索和搜索结果页面
【发布时间】:2022-07-07 19:12:57
【问题描述】:

我们在 shopware 6.4.6.1 中使用弹性搜索。主页,列表页面和产品页面很快。 模糊/ajax 实时搜索也很快。

如果按回车键或点击“显示所有搜索结果”,页面会很慢。 您必须等待 30-40 秒。

这家商店有大约 50.000 种具有许多属性的产品。 我们用潮道调试。附上任何资料。

有谁知道,我怎样才能获得搜索页面的速度?

截图: Tideways Screen

控制器:Shopware\Storefront\Controller\SearchController::search 堆栈:

#1 PDOStatement::execute
#2 Doctrine\DBAL\Driver\PDOStatement::execute
#3 Doctrine\DBAL\Connection::executeQuery
#4 Doctrine\DBAL\Query\QueryBuilder::execute
#5 Shopware\Core\Framework\DataAbstractionLayer\Dbal\EntityAggregator::fetchAggregation
#6 Shopware\Core\Framework\DataAbstractionLayer\Dbal\EntityAggregator::aggregate
#7 Shopware\Elasticsearch\Framework\DataAbstractionLayer\ElasticsearchEntityAggregator::aggregate
#8 Shopware\Core\System\SalesChannel\Entity\SalesChannelRepository::aggregate
#9 Shopware\Core\Content\Product\SalesChannel\Listing\ProductListingLoader::load
#10 Shopware\Core\Content\Product\SalesChannel\Search\ProductSearchRoute::load
#11 Shopware\Core\Content\Product\SalesChannel\Search\CachedProductSearchRoute::Shopware\Core\Content\Product\SalesChannel\Search\{closure}
#12 Shopware\Core\System\SystemConfig\SystemConfigService::trace
#13 Shopware\Core\Framework\Adapter\Cache\CacheTracer::Shopware\Core\Framework\Adapter\Cache\{closure}
#14 Shopware\Core\Framework\Adapter\Translation\Translator::trace
#15 Shopware\Core\Framework\Adapter\Cache\CacheTracer::Shopware\Core\Framework\Adapter\Cache\{closure}
#16 Shopware\Core\Framework\Adapter\Cache\CacheTagCollection::trace
#17 Shopware\Core\Framework\Adapter\Cache\CacheTracer::trace
#18 Shopware\Storefront\Framework\Cache\CacheTracer::Shopware\Storefront\Framework\Cache\{closure}
#19 Shopware\Storefront\Theme\ThemeConfigValueAccessor::trace
#20 Shopware\Storefront\Framework\Cache\CacheTracer::trace

问题 SQL:

# search*page::aggregation::price
SELECT
  SUM(
    IF(product.product_number = ?, ?, ?) + IF(product.product_number LIKE ?, ?, ?) + IF(
      IFNULL(
        product.manufacturer_number,
        product.parent.manufacturer_number
      ) = ?,
      ?,
      ?
    ) + IF(
      IFNULL(
        product.manufacturer_number,
        product.parent.manufacturer_number
      ) LIKE ?,
      ?,
      ?
    ) + IF(
      IFNULL(product.ean, product.parent.ean) = ?,
      ?,
      ?
    ) + IF(
      IFNULL(product.ean, product.parent.ean) LIKE ?,
      ?,
      ?
    ) + IF(
      COALESCE(
        product.translation.name,
        product.parent.translation.name
      ) = ?,
      ?,
      ?
    ) + IF(
      COALESCE(
        product.translation.name,
        product.parent.translation.name
      ) LIKE ?,
      ?,
      ?
    ) + IF(
      COALESCE(product.categories.translation.name) = ?,
      ?,
      ?
    ) + IF(
      COALESCE(product.categories.translation.name) LIKE ?,
      ?,
      ?
    )
  ) as _score,
  MIN(
    IFNULL(
      COALESCE(
        (
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          ROUND(
            (
              ROUND(
                CAST(
                  (
                    JSON_UNQUOTE(JSON_EXTRACT(product.cheapest_price_accessor, ?)) * ?
                  ) as DECIMAL(?, ?)
                ),
                ?
              )
            ) * ?,
            ?
          ) / ?
        ),(
          R

【问题讨论】:

    标签: elasticsearch shopware shopware6


    【解决方案1】:

    由于 ES 查询错误,似乎执行了 SQL 回退。 您可以在 .env 文件中使用 SHOPWARE_ES_THROW_EXCEPTION=1 禁用此行为,以查看实际的 Elasticsearch 查询错误。

    【讨论】:

      猜你喜欢
      • 2023-03-10
      • 1970-01-01
      • 2021-06-08
      • 2015-09-11
      • 2012-08-23
      • 1970-01-01
      • 2016-11-30
      • 2012-01-24
      • 1970-01-01
      相关资源
      最近更新 更多