Skip to content

Commit 60968eb

Browse files
committed
bug #189 [Store][MariaDB] Fix query with minScore argument (yoye)
This PR was merged into the main branch. Discussion ---------- [Store][MariaDB] Fix query with `minScore` argument | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | no | Issues | | License | MIT Fix SQL query generation with dynamic field name in WHERE clause Previously, the WHERE clause used a raw format string with a `%1$s` placeholder, but it was not processed by `sprintf`, resulting in the literal `%1$s` being inserted into the SQL. This caused the prepared SQL statement to be incorrect and fail at runtime. Commits ------- 35bebe1 Fix MariaDB Store query with minScore argument
2 parents 1d83ca3 + 35bebe1 commit 60968eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/store/src/Bridge/MariaDB/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function query(Vector $vector, array $options = [], ?float $minScore = nu
113113
SQL,
114114
$this->vectorFieldName,
115115
$this->tableName,
116-
null !== $minScore ? 'WHERE VEC_DISTANCE_EUCLIDEAN(%1$s, VEC_FromText(:embedding)) >= :minScore' : '',
116+
null !== $minScore ? \sprintf('WHERE VEC_DISTANCE_EUCLIDEAN(%1$s, VEC_FromText(:embedding)) >= :minScore', $this->vectorFieldName) : '',
117117
$options['limit'] ?? 5,
118118
),
119119
);

0 commit comments

Comments
 (0)