11 / 15Advanced
Search the vector database
With your movie data on-chain, complete with vector embeddings and full metadata, you can run semantic searches in natural language and get back the closest matches.
Activate vector_demo_env if it isn't active yet
From the rell/ folder:
cd ../pythonFrom the project root:
cd pythonNext, activate the environment:
source vector_demo_env/bin/activateRun the script
Go to the python/ folder and run this command:
python search_movies.pyAt the prompt, type a search query, such as:
A man wakes up in a world controlled by machines.The script then does three things:
- Generates an embedding for your query with the model set in your
.envfile - Queries the on-chain vector index for the nearest embeddings
- Returns the best-matching movies together with their metadata
Filter your search by genre (optional)
A second version of the script lets you restrict results to a genre:
python search_movies_filtered.pyIt behaves the same as the standard search, except that it asks you for a genre before it runs the query.
For instance:
- Query:
A robot gains self-awareness - Genre:
Science Fiction
You get back only semantically relevant results from that genre.
What’s included in the results?
Every result shows:
- Title
- Release date
- Plot summary
- Genres, languages, and countries
- Similarity score (a distance, so lower means more similar)
Because similarity comes from vector distance, results match on meaning, not just on shared words.
Try your own queries
Some prompts to experiment with:
- A woman leads a rebellion against a dystopian regime
- Movies about AI taking control of humanity
- Stories involving time travel and paradoxes
- A team of explorers enters another dimension
Use them with the standard script, or pair them with a genre filter in search_movies_filtered.py.
What’s next?
The next module looks under the hood: how Rell stores and queries vectors and links them to movie metadata.