|
1 |
| -Imagine you’re building a movie recommendation app, and your users expect intuitive, meaningful results, not just keyword matches, but intelligent understanding. |
2 |
| - |
3 |
| -Not just keyword matching, but semantic understanding — powered by vector embeddings. These are numerical representations of text that capture meaning, allowing you to search by intent rather than exact words. |
| 1 | +Imagine you’re building a movie recommendation app that goes beyond simple keyword matching. Your users want recommendations based on the meaning of the movie plots — an intuitive and meaningful search experience powered by semantic understanding. |
4 | 2 |
|
5 | 3 | ### Store Movie Documents with Vector Embeddings
|
6 |
| - |
7 |
| -Let’s import a dataset containing plot summaries, each paired with an embedding vector. Each movie JSON document contains metadata like title, genre, year, and a vector embedding of the plot. |
| 4 | +Semantic search uses vector embeddings — numerical representations of text that capture the meaning of sentences. This enables search by intent rather than just keywords. |
| 5 | +Let’s import a dataset containing plot summaries, each paired with an embedding vector. |
| 6 | +Each movie is stored as a JSON document with: |
| 7 | + - `title`, `genres`, `year`, `plot` |
| 8 | + - `embedding`, which is a binary-encoded `FLOAT32[]` used for vector similarity that can be generated using sentence-transformers or similar libraries. Demo uses 8-dim vectors; production models typically use 128–1536 dimensions. |
8 | 9 |
|
9 | 10 | ```redis:[run_confirmation=true] Upload Movies
|
10 | 11 | JSON.SET movie:001 $ '{"title":"Toy Story","genres":["Animation","Comedy","Family"],"plot":"Toys come to life when humans arent around.","year":1995,"embedding":[0.22,0.04,0.33,0.12,-0.02,0.17,0.09,0.01]}'
|
@@ -154,7 +155,6 @@ FT.SEARCH idx:movies '@genres:{"Animated"|"Sci-Fi"} =>[KNN 5 @embedding $vec AS
|
154 | 155 | This makes Redis recommendations responsive to evolving user preferences without retraining embeddings.
|
155 | 156 |
|
156 | 157 | ### Next Steps
|
157 |
| - - Now that you’ve seen the basics, here are a few ideas to extend this: |
158 |
| - - Build personalized watchlists based on user preferences and past behavior. |
159 |
| - - Power chatbots that provide context-aware movie suggestions. |
160 |
| - - Blend keyword and vector search for a richer discovery experience. |
| 158 | + - Build a UI that lets users type natural language queries and get semantic recommendations instantly |
| 159 | + - Add personalization by combining user preferences with semantic search |
| 160 | + - Explore advanced vector search techniques like HNSW indexing for large datasets |
0 commit comments