首页 > 解决方案 > SQLSTATE [42000]:语法错误或访问冲突:1584 调用存储函数“sphinx_snippets”中的参数不正确

问题描述

在我的 Laravel 脚本中使用 sphinx 搜索单词会返回此错误:

SQLSTATE[42000]: Syntax error or access violation: 1584 Incorrect parameters in the call to stored function 'sphinx_snippets' (SQL: select articles.*, sphinx_snippets(articles.title, 'articles', 'dff', 280 AS `limit`, 8 AS around, '<span class="highlight">' AS before_match, '</span>' AS after_match) as title_snippet, sphinx_snippets(articles.abstract, 'articles', 'dff', 280 AS `limit`, 8 AS around, '<span class="highlight">' AS before_match, '</span>' AS after_match) as abstract_snippet from `articles_index` inner join `articles` on `articles_index`.`id` = `articles`.`id` where articles_index.query = '@* dff;sort=relevance;fieldweights=title,2,abstract,1,keywords,10;mode=extended;offset=0;
limit=25')

解决办法是什么。
我也通过终端在 mysql 中运行此代码

select articles.*, sphinx_snippets(articles.title, 'articles', 'dff') as title_snippet from articles;

得到错误:

错误 1305 (42000):函数 database_name.sphinx_snippets 不存在

标签: sqllaravelsphinx

解决方案


推荐阅读