How text embedding models power search and RAG: pooling a sentence vector, contrastive InfoNCE training, bi-encoders vs cross-encoders, and HNSW indexes.