Added a filter function to the nearest neighbour search object