Refactory posts search code
Fixed order to posts