FunctionScoreQuery example



    /** * {@inheritdoc} */
    public function handle(
        CriteriaPartInterface $criteriaPart,
        Criteria $criteria,
        Search $search,
        ShopContextInterface $context
    ) {
        $randomQuery = new FunctionScoreQuery(new MatchAllQuery());
        $randomQuery->addRandomFunction(md5(uniqid('swag', true)));

        $search->addSort(new FieldSort('_score'));
        $search->addQuery($randomQuery);
    }
}
Home | Imprint | This part of the site doesn't use cookies.