I want to implement semantic search but in an encrypted fashion.
For storing passwords, we store Enc(password) in a database, and when a user logs in, we check if Enc(query) == entry in the database.
But for semantic search, is it possible to do the following: A user has a bunch of d-dimensional text embeddings (say from an OpenAI model) e_1 e_2 ... e_n. We then store Enc(e_1) ... Enc(e_n) in a database.
Then, the user searches for some query q. With normal semantic search, we would compare the distance between each e_i and q and choose the closest distance matches. But is there a scheme such that the dist(e_i, q) is approximately equal to dist(Enc(e_i), Enc(q))? This would allow us to do semantic search without an attacker learning about the contents of each e_i and q.