与 Cake php 一起实现 Sphinx API 的问题
我正在开发一个项目,需要使用 Cake php 实现 SphinxSearch。所以我只是尝试在其中使用一个组件和行为。它的链接是:-
http:// /bakery.cakephp.org/articles/eugenioclrc/2010/07/10/sphinx-component-and-behavior
我正在请求 Sphinx API,如下所示:
$sphinx = array('matchMode' => SPH_MATCH_ALL, 'sortMode' => array(SPH_SORT_EXTENDED => '@relevance DESC'));
$results = $this->ModelName->find('all', array('search' => 'Search_Query', 'sphinx' => $sphinx));
pr($result);
对于上面的内容,它工作正常,但是当我尝试最小化响应时间查询表的特定字段(使用扩展匹配模式,即SPH_MATCH_EXTENDED2),Sphinx无法输出任何结果。我使用的扩展查询如下:-
$sphinx = array('matchMode' => SPH_MATCH_EXTENDED2, 'sortMode' => array(SPH_SORT_EXTENDED => '@relevance DESC'));
$results = $this->ModelName->find('all', array('search' => '@Field_name Search_Query', 'sphinx' => $sphinx));
pr($results);
任何人都可以认识到我哪里出了问题吗?如果我在某些地方出错,请帮助。
提前致谢。
I am working on project where I need to implement SphinxSearch with Cake php. So I am simply trying to use a component and behaviour into it. The link to it, is :-
http://bakery.cakephp.org/articles/eugenioclrc/2010/07/10/sphinx-component-and-behavior
I am requesting Sphinx API like below :
$sphinx = array('matchMode' => SPH_MATCH_ALL, 'sortMode' => array(SPH_SORT_EXTENDED => '@relevance DESC'));
$results = $this->ModelName->find('all', array('search' => 'Search_Query', 'sphinx' => $sphinx));
pr($result);
For above it is working fine ,but when I tried to minimise the response time querying to a particular field of the table (using extended match modes,i.e. SPH_MATCH_EXTENDED2) , Sphinx just fails to output any result. The extended query which I used is given below :-
$sphinx = array('matchMode' => SPH_MATCH_EXTENDED2, 'sortMode' => array(SPH_SORT_EXTENDED => '@relevance DESC'));
$results = $this->ModelName->find('all', array('search' => '@Field_name Search_Query', 'sphinx' => $sphinx));
pr($results);
Can anyone recognise where am I going wrong with it? Please help if I am going wrong some where.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
顺便说一句,当您使用 EXTENDED2 模式时,请确保您的排名模式已相应设置。
编辑:
无论如何,回到你的问题,查看该组件/行为代码,你可以立即看到没有进行任何错误检查。尝试稍微更改一下代码,这样您至少可以看到错误和/或警告。
组件
行为
我希望有所帮助。
Btw, when you use EXTENDED2 mode make sure your rank mode is set accordingly.
Edit:
Anyway back to you problem, looking at that component/behavior code you can see right away that no error checking is done whatsoever. Try changing the code a bit so you can at least see the errors and/or warnings.
Component
Behavior
I hope that helps.
正如你所说,
这意味着这是一个错误:
请检查您是否已使用 sql_query 将特定字段添加到索引中,
同时检查您正在搜索的字段是否不是属性
根据 sphinx 文档:
As you said ,
That means it's an error :
Please check whether you have added the specific field to the indexing by using sql_query
Also check if the field you are searching for is not an attribute
As per the sphinx documentation :