Empty query protection on queryall
Added locks to prevent indexing the same collection simultaneously