Skip to main content

๐Ÿ“˜ Semantic Search

Semantic search is a search technique that uses the meaning of words to find relevant results. It's what powers large language models that we see nowadays.

Using semantic search, we can find relevant results even if the search terms don't appear in the results. For example, if we search for "How to make a cake", we can find results that contain the words "How to bake a cake" or "How to make a pie".

This is done with vectors. Vectors are mathematical representations of words. They are used to find the similarity between words. For example, the word "cake" is similar to the word "pie" because they are both desserts.

Where does MongoDB come in?โ€‹

With its document model, MongoDB is a great fit for storing vectors. You can store vectors as arrays of numbers in a document.

Instead of storing your vectors in a separate "vector" database, you can store them in the same database as your other data. This makes it easier to query your data. And you don't have the overhead of maintaining and keeping in sync a separate database.