Optimizing Bi-Encoder for Named Entity Recognition via Contrastive Learning