How to make Partial Match Queries work

I have a magento 2 installation, my client wants to SKU: PP121212 display results when typing only the last numbers (121212), I’ve found this tutorial online https://www.algolia.com/doc/tutorials/indexing/advanced/how-can-i-make-queries-within-the-middle-of-a-word/ but I am not sure how and where to include those codes, can someone help?

Hello Nick,

you can hook your code to algolia_after_create_product_object event, and there you can split SKU attribute to pieces with the code mentioned in the tutorial. Those pieces you’ll put into a new attribute of the record and it will get indexed.

Would that work for you?