If documents are similar, you want the two embeddings to be close to each other, if they are dissimilar, you want them to be far apart.
Binary relevance judgements of course don't necessarily produce an ordering, but usually over a large enough set of training examples some will be better matches than others.
"Learning to Rank" gets you into all kinds of labels and losses if you want to go down that rabbit hoel.
https://lilianweng.github.io/posts/2021-05-31-contrastive/
If documents are similar, you want the two embeddings to be close to each other, if they are dissimilar, you want them to be far apart.
Binary relevance judgements of course don't necessarily produce an ordering, but usually over a large enough set of training examples some will be better matches than others.
"Learning to Rank" gets you into all kinds of labels and losses if you want to go down that rabbit hoel.