Commit abc3d82
fix: use column expression in order_by instead of string literal
The order_by(asc("distance")) call fails because SQLAlchemy requires
a column expression object, not a string literal. This fix extracts
the distance expression to a variable and references it directly in
the order_by clause.
Changes:
- Extract distance_expr before the query
- Use distance_expr in session.query() and order_by()
- Remove unused asc import
- Add regression test for similarity_search_with_score_by_vector1 parent 4a7b002 commit abc3d82
2 files changed
+44
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
519 | 518 | | |
520 | 519 | | |
521 | 520 | | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
522 | 530 | | |
523 | 531 | | |
524 | 532 | | |
525 | 533 | | |
526 | 534 | | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
| 535 | + | |
534 | 536 | | |
535 | 537 | | |
536 | | - | |
| 538 | + | |
537 | 539 | | |
538 | 540 | | |
539 | 541 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
0 commit comments