modify the weighting part in KNNSearch class