Throw exception if function in function score query is null

closes #6292