PostgreSQL: Find sentences closest to a given sentence
问题 I have a table of images with sentence captions. Given a new sentence I want to find the images that best match it based on how close the new sentence is to the stored old sentences. I know that I can use the @@ operator with a to_tsquery but tsquery accepts specific words as queries. One problem is I don't know how to convert the given sentence into a meaningful query. The sentence may have punctuation and numbers. However, I also feel that some kind of cosine similarity thing is what I need