1

How can I limit the search results in Magento 2 with query string, we have something like this to perform the search

http://domain.com/catalogsearch/result/?q=search_term

Is there any query string parameter to limit the resulting rows?

ex : ?q=search_term&limit=5

1 Answer 1

2

You can use product_list_limit as the query parameter to restrict the results.

You can see that's how the toolbar class handles the limit:

public function getLimit()
{
    return $this->request->getParam(self::LIMIT_PARAM_NAME);
}

With:

/**
 * Products per page limit order cookie name
 */
const LIMIT_PARAM_NAME = 'product_list_limit';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.