Astronomy Catalog Hybrid Search
A real, published star catalog: the HYG Database
v4.1 (a combined Hipparcos / Yale Bright
Star / Gliese catalog). 22,493 real stars within ~100pc of the Sun, loaded as a hybrid
table with a real photometric Vector(3) embedding (z-scored absolute magnitude + B-V
color index + a bias term), searched for real solar-analog candidates.
Filtered/hybrid vector search
Section titled “Filtered/hybrid vector search”CREATE VECTOR INDEX ON stars(photo_vec)SEARCH stars ON photo_vec QUERY [0.0, 0.0, 1.0] LIMIT 20 FILTER spect_class = "G"FILTER post-filters the index-accelerated top-k results by an ordinary relational
predicate: here, restricting an intrinsic-brightness/color similarity search to G-type
stars, the Sun’s own spectral class.
The same query, expressed as a hybrid WHERE
Section titled “The same query, expressed as a hybrid WHERE”SELECT proper_name, dist, absmag, ciFROM starsWHERE COSINE_SIM(photo_vec, [0.0, 0.0, 1.0]) > 0.999 AND spect_class = "G"Both forms return the same 18 real solar-analog candidates: real stars in
constellations like Tucana, Cetus, and Hydra whose absmag/ci sit within ~0.02 of the
Sun’s own 4.85 / 0.656. EXPLAIN on the second form confirms CosineFilterExec fired:
the planner decomposed the AND, index-accelerated the cosine conjunct, and applied
spect_class = "G" as a cheap post-filter, not a full scan.
Every result cross-checked exactly (20/20) against a brute-force numpy cosine-similarity pass over the full real embedding array.
An honest methodology finding, not an engine bug
Section titled “An honest methodology finding, not an engine bug”Raw [absmag, ci] makes COSINE_SIM misleading here: cosine similarity is
angle/scale-invariant, so a star at exactly double the Sun’s absmag/ci scores a
near-perfect match despite being a physically different star. Caught by inspecting the
raw top-20 before trusting it; fixed by z-score-standardizing both features (verified
against a Euclidean-distance brute force in numpy first, confirming 20/20 agreement,
before ever touching the engine). Real data surfaces real modeling lessons, not just
engine bugs.

