A Relevanssi Premium customer had a problem with product codes. The codes are in the format “ABC 100”, a group of letters and digits with a space in between. Users may search for the codes without the space, so the post should be found with “ABC 100” or “ABC100”. The……is relatively straightforward and uses the relevanssi_post_content and relevanssi_post_title_before_tokenize filter hooks: add_filter( ‘relevanssi_post_content’, ‘rlv_product_codes’ ); add_filter( ‘relevanssi_post_title_before_tokenize’, ‘rlv_product_codes’ ); /** * Index product codes in the format “ABC 123” ie. group of letters, * a space, group of digits both ways, with or without the space, so * that the……product codes don’t appear in a specific custom field but in the post titles and content. Thus the solution is to check both of those, and whenever something is found that matches the product code pattern, that string is indexed as is, but also with the space removed. The code…