How to limit results if query is an exact match?

We’re using the Magento 2 Algolia extension to allow users to search our products, it searches based on a “SKU” attribute and it works as intended.

However we were wondering if it’s possible to only show 1 result if it matches the exact query? For example:

  • Scenario 1: I search for “ABC” which doesn’t match any SKU so other suggestions are shown (ABC1, ABC2, etc)
  • Scenario 2: I search for “ABC1” which matches an SKU so only that product is shown.

As it is now the product that matches the SKU is shown first but we also get suggestions for SKUs matching “ABC12”, “ABC13”, and so on.

Is it possible to have this behaviour?

Thanks.