finish bm25 function