I've found embeddings to perform quite poorly on code because
1) user queries are not semantically similar to target code in most cases
2) often times two very concretely related pieces of code are not at all semantically similar
Yes but generating that index would be expensive
Why exactly? You mean to construct the embeddings or to embed the queries?