Fix bug in dropping hash index before mass insert
Pass database handle in when matching, in preparation for batch tests