Skip to content

Commit 5213669

Browse files
committed
another attempt to use the index 2
1 parent 1447b40 commit 5213669

File tree

1 file changed

+3
-3
lines changed
  • store/backend/neurostore/resources

1 file changed

+3
-3
lines changed

store/backend/neurostore/resources/data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,9 @@ def ann_query_object(
617617
embedding_expr = PipelineEmbedding.embedding
618618

619619
distance_expr = embedding_expr.op("<=>")(qvec)
620-
distance = distance_expr.label("distance")
620+
distance = sa.cast(distance_expr, sa.Float).label("distance")
621621

622-
# Build the ANN CTE
622+
# Build the ANN subquery
623623
inner = (
624624
sa.select(
625625
PipelineEmbedding.base_study_id,
@@ -638,7 +638,7 @@ def ann_query_object(
638638
q = (
639639
q.with_entities(BaseStudy)
640640
.join(nearest, BaseStudy.id == nearest.c.base_study_id)
641-
.filter(sa.cast(nearest.c.distance, sa.Float) < thr)
641+
.filter(nearest.c.distance < thr)
642642
.order_by(nearest.c.distance)
643643
.params(
644644
qvec=qvec_value,

0 commit comments

Comments
 (0)