My proximity searches using Azure Search are working correctly. It returns results where the words specified exist and are within the specified proximity, and doesn't return results where the words are not close enough together.
But the hit highlights returned for those documents include highlights that don't match the proximity constraint.
For example, if I search for "potato pancakes"~2
it will return hit highlights where the words are within three words of each other. But it will also return hit highlights from the same document that only contain one of the words, or where the words are further apart than the proximity specified.
Is there a way to make the hit highlights honor the proximity parameter?
Unfortunately we don't have a way to customize highlighting today. Highlighting runs on the entire document inside the query result set. In this case, as you have observed, highlighting will run on all documents containing potato and pancakes within a distance of 3.
You can upvote this feedback to prioritize highlighting customization.