Unify custom_boost_factor, custom_score and custom_filters_score and add distance scoring

These commits close issues issue #3407 and issue #3307