Where to place hook for Instantsearch custom thumbnail sizes?

The small 150x150 images look very bad on mobile displays so I’m trying to place the suggested hook into my site code so that algolia will pull a higher quality image.

I’m not sure where to place the code. I have tried placing it in my themes function.php & in algolia.php. After rebuilding the index on both attempts, I still can’t get the image size to change.

add_filter(‘algolia_post_images_sizes’, function($sizes) {
$sizes = ‘medium’;

return $sizes;


So from searching older4 posts it is supposed to be in functions.php. Unfortunately it does not pull a higher quality image. It is stuck pulling low quality 150x150 thumbnails.

Figured it out. Had to change the variable thumbnail in instantsearch.php to my custom thumbnail name to get it displaying correctly. Topic can be closed.

Can you explain this closer? Where exactly did you change the variable, and what custom thumbnail name did you use? Do I still need to use the hook after this, in the functions.php file?