Fix MariaDB LIMIT/OFFSET bound-parameter error in corpus API
MariaDB rejects ? placeholders for LIMIT/OFFSET when emulate_prepares=false. Interpolate $limit and $offset as ints directly into SQL strings in both corpus-documents.php and corpus-search.php BM25 paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -59,10 +59,9 @@ try {
|
||||
AND d.source_url NOT LIKE ?
|
||||
$catClause
|
||||
ORDER BY score DESC
|
||||
LIMIT ?";
|
||||
LIMIT $limit";
|
||||
$params = [$query, 1, $query, $excludeLike];
|
||||
if ($category !== null) $params[] = $category;
|
||||
$params[] = $limit;
|
||||
$stmt = $ragDb->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
@@ -80,11 +79,10 @@ try {
|
||||
AND d.source_url NOT LIKE ?
|
||||
$catClause
|
||||
ORDER BY (d.title LIKE ?) DESC
|
||||
LIMIT ?";
|
||||
LIMIT $limit";
|
||||
$params = [1, $like, $like, $excludeLike];
|
||||
if ($category !== null) $params[] = $category;
|
||||
$params[] = $like;
|
||||
$params[] = $limit;
|
||||
$stmt = $ragDb->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
Reference in New Issue
Block a user