# Search the vector database · Semantic search on Chromia using Vector DB · Learn Chromia

> 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…

Source: https://chromia.com/learn/vector-db-movie-demo/search/

Semantic search on Chromia using Vector DBLesson 11 of 15

1. [01Searching movies semantically on Chromia](https://chromia.com/learn/vector-db-movie-demo/introduction/)

Module 1: Project setup

1. [02Overview](https://chromia.com/learn/vector-db-movie-demo/setup/)
2. [03Choose an embedding model](https://chromia.com/learn/vector-db-movie-demo/setup/embedding-model/)
3. [04Configure your Rell module](https://chromia.com/learn/vector-db-movie-demo/setup/configure.rell/)
4. [05Deploy your Rell module](https://chromia.com/learn/vector-db-movie-demo/setup/deploy-rell-module/)
5. [06Finalize your Python environment](https://chromia.com/learn/vector-db-movie-demo/setup/finalize-python-env/)

Module 2: Running the data pipeline

1. [07Overview](https://chromia.com/learn/vector-db-movie-demo/data-pipeline/)
2. [08Preprocess movie data](https://chromia.com/learn/vector-db-movie-demo/data-pipeline/preprocess/)
3. [09Generate sentence embeddings](https://chromia.com/learn/vector-db-movie-demo/data-pipeline/generate-embeddings/)
4. [10Store vectors on the blockchain](https://chromia.com/learn/vector-db-movie-demo/data-pipeline/upload-vectors/)

1. [11Search the vector database](https://chromia.com/learn/vector-db-movie-demo/search/)

Module 4: A deep dive into the code

1. [12Overview](https://chromia.com/learn/vector-db-movie-demo/code-deep-dive/)
2. [13Link your data to the Vector DB with Rell](https://chromia.com/learn/vector-db-movie-demo/code-deep-dive/rell-interface/)
3. [14Work with Chromia through the Python client](https://chromia.com/learn/vector-db-movie-demo/code-deep-dive/python-client/)

1. [15Use cases and extensions](https://chromia.com/learn/vector-db-movie-demo/use-cases/)

[Learn](https://chromia.com/learn/)[Semantic search on Chromia using Vector DB](https://chromia.com/learn/vector-db-movie-demo/)

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:

bash

```nolines
cd ../python
```

From the project root:

bash

```nolines
cd python
```

Next, activate the environment:

bash

```nolines
source vector_demo_env/bin/activate
```

## Run the script

Go to the `python/` folder and run this command:

bash

```nolines
python search_movies.py
```

At the prompt, type a search query, such as:

text

```nolines
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 `.env` file
* 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:

bash

```nolines
python search_movies_filtered.py
```

It 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.

Written for this site from Chromia’s public course. Code samples are the course’s own.

[← Previous**Store vectors on the blockchain**](https://chromia.com/learn/vector-db-movie-demo/data-pipeline/upload-vectors/)[Next →**Module 4: A deep dive into the code**](https://chromia.com/learn/vector-db-movie-demo/code-deep-dive/)

On this page

* [Run the script](#run-the-script)
* [Filter your search by genre (optional)](#filter-your-search-by-genre-optional)
* [What’s included in the results?](#whats-included-in-the-results)
* [Try your own queries](#try-your-own-queries)
* [What’s next?](#whats-next)
