Skip to content

Commit a1b3609

Browse files
committed
Add vector search score to the vector search results
1 parent 3e0b180 commit a1b3609

4 files changed

Lines changed: 20 additions & 0 deletions

File tree

mflix/client/app/components/MovieCard/MovieCard.module.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@
105105
font-size: 14px;
106106
}
107107

108+
.vectorScore {
109+
margin: 0 0 4px 0;
110+
color: #0066cc;
111+
font-size: 13px;
112+
font-weight: 500;
113+
background: #e6f0ff;
114+
padding: 4px 8px;
115+
border-radius: 4px;
116+
display: inline-block;
117+
}
118+
108119
.movieGenres {
109120
margin: 0;
110121
color: #888;

mflix/client/app/components/MovieCard/MovieCard.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ export default function MovieCard({ movie, isSelected = false, onSelectionChange
6969
{movie.year && (
7070
<p className={movieStyles.movieYear}>({movie.year})</p>
7171
)}
72+
{movie.score !== undefined && (
73+
<p className={movieStyles.vectorScore}>
74+
🎯 Vector Score: {movie.score.toFixed(4)}
75+
</p>
76+
)}
7277
{movie.imdb?.rating && (
7378
<p className={movieStyles.movieRating}>{movie.imdb.rating}/10</p>
7479
)}

mflix/client/app/lib/api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,8 @@ export async function vectorSearchMovies(searchParams: {
725725
genres: item.genres || [],
726726
directors: item.directors || [],
727727
cast: item.cast || [],
728+
// Preserve the vector search score for display in UI
729+
score: item.score,
728730
// Add default values for fields not included in VectorSearchResult
729731
fullplot: undefined,
730732
released: undefined,

mflix/client/app/types/movie.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ export interface Movie {
5151
};
5252
metacritic?: number;
5353
type?: string;
54+
/** Vector search score (only present in vector search results) */
55+
score?: number;
5456
}
5557

5658
/**

0 commit comments

Comments
 (0)