Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Movie Recommendation System using Oracle Vector Search

Overview

This project implements a semantic movie recommendation system using Oracle Database with native vector support.

Instead of traditional filtering (genre, rating), the system uses:

  • text embeddings
  • cosine similarity
  • vector search (ANN)

to recommend movies based on semantic similarity.


Solution Architecture

TMDB API (external data)
│
▼
Ingestion Script (Deno + TypeScript)
│
▼
Oracle Database (Docker container)
│
├─ Store movie data (relational + JSON)
├─ Generate embeddings → VECTOR(384) (ONNX model)
├─ Create vector index (ANN)
└─ Similarity search (cosine distance)
│
▼
Web Server (Hono)
│
▼
Client (Browser UI)

Steps

1. Load the embedding model into Oracle

The all-MiniLM-L6-v2 model (ONNX format) is copied into the Docker container and loaded into Oracle. This allows embeddings to be generated directly inside the database.


2. Load movie data

Movie data is fetched from the TMDB API using the ingestion script and inserted into the database.


3. Prepare text input

title + genres + overview

4. Generate vectors

UPDATE movies
SET embedding = VECTOR_EMBEDDING(mini_lm_model USING text_input);

Each movie is transformed into a 384-dimensional embedding vector.


5. Create vector index

CREATE VECTOR INDEX movies_emb_idx
ON movies (embedding)
DISTANCE COSINE;

This enables efficient similarity search.


6. Query similarity

SELECT *
FROM movies
ORDER BY VECTOR_DISTANCE(
embedding,
(SELECT embedding FROM movies WHERE id = :id),
COSINE
)
FETCH FIRST 10 ROWS ONLY;

Returns the most similar movies.


Score Interpretation

Score Meaning
0.00 Identical movie
< 0.05 Almost identical
< 0.15 Highly similar
< 0.30 Moderately similar
< 0.50 Weak similarity
≥ 0.50 Different movies

Notes

  • Score = cosine distance
  • Lower = more similar

Data Model

CREATE TABLE movies (
id NUMBER PRIMARY KEY,
title VARCHAR2(255),
overview CLOB,
release_date VARCHAR2(20),
poster_path VARCHAR2(255),
genres JSON,
vote_average FLOAT,
embedding VECTOR(384)
);

Technology Stack

Layer Technology Purpose
Database Oracle 23c storage + vector search
ML Model ONNX (MiniLM) embeddings
Backend Deno + Hono server
Language TypeScript logic
Data Source TMDB API movie data
Containerization Docker runtime
Orchestration Docker Compose service management

Features

  • Semantic movie recommendations
  • Vector embeddings stored in DB
  • Cosine similarity search
  • ANN vector index
  • Full pipeline (ingestion → embedding → query)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages