getProductName example

CriteriaPartInterface $criteriaPart,
        Criteria $criteria,
        Search $search,
        ShopContextInterface $context
    ) {
        $this->handleFilter($criteriaPart$criteria$search$context);
    }

    private function addQuery(SimilarProductCondition $criteriaPart, Search $search): void
    {
        $productId = $criteriaPart->getProductId();
        $productName = $criteriaPart->getProductName();
        $categories = $this->getProductCategories($productId);

        $query = new BoolQuery();

        $nameQuery = new MultiMatchQuery(['name', 'keywords']$productName['boost' => 5]);
        $categoriesQuery = new TermsQuery('categoryIds', $categories['boost' => 0.2]);

        $query->add($nameQuery, BoolQuery::SHOULD);
        $query->add($categoriesQuery, BoolQuery::MUST);

        $not = new BoolQuery();
        
Home | Imprint | This part of the site doesn't use cookies.