add maxweightloss also to order by clause user input query