cakephp 中 Sphinx 中的多重查询
$query = '@(name,email,bio) ' . '"' . $this->passedArgs['name'] . '"~100';
$query2 = '@(name,email,bio) ' . '"' . $this->passedArgs['name'] . '"~300'
$query3 = '@(name,email,bio) ' . '"' . $this->passedArgs['name'] . '"/3';
$query4 = '@(name,email,biot) ' . '"' . $this->passedArgs['name'] . '"/1';
我想在一个查询中执行此操作!如果我使用“|” OR运算符,大约需要2分钟才能显示结果!
无论如何,在 sphinxapi 中使用多重查询我可以将所有这些查询合并为一个吗?
$query = '@(name,email,bio) ' . '"' . $this->passedArgs['name'] . '"~100';
$query2 = '@(name,email,bio) ' . '"' . $this->passedArgs['name'] . '"~300'
$query3 = '@(name,email,bio) ' . '"' . $this->passedArgs['name'] . '"/3';
$query4 = '@(name,email,biot) ' . '"' . $this->passedArgs['name'] . '"/1';
I want to execute this in one query! If I use the "|" OR operator, it takes approx 2minutes to display the results!
Is there anyway using multiquery in sphinxapi I can combine all these queries into one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你可以试试
,可能会快一点。
You could try
Might be a bit quicker.
如果我理解(从您的评论中),您正在寻找
@(name,email,bio)
字段中的$this->passedArgs['name']
,~100
个字符内OR~300
个字符OR 至少有/3
至少匹配 OR 的单词/1
单词匹配?为什么不将其分成两个不同的查询,首先是最受限制的:
一起执行这些查询。如果您没有得到任何结果,请执行以下查询,也将
|
放在一起。If I understand (from your comment), you're looking for
$this->passedArgs['name']
in the@(name,email,bio)
fields, within~100
characters OR~300
characters OR having at least/3
words matching OR at least/1
word matching?Why not then split it out to two different queries, the most limiting first:
perform those queries,
|
d together. If you get no results from it, perform the below query, also|
d together.我尝试使用 OR(|) 运算符进行单个查询,Sphinx 没有返回准确的结果。后来发现 AddQuery 函数可以帮助我从多个查询中获取结果并将其合并为一个。
我什至可以为每个查询指定单独的索引。请参阅 Sphinx 文档 AddQuery
我执行了 SetIndexWeights 调用来优先考虑我拥有的多个索引用过的。请参阅 Sphinx 文档 SetIndexWeights
I tried the single query using OR(|) operator, Sphinx wasn't returning accurate results. Later found out AddQuery function which helped me in getting results from multiple queries and merging into one.
I can even specify separate indexes for each query. Refer Sphinx Documentation AddQuery
I did SetIndexWeights call to prioritize multiple indexes that I have used. Refer Sphinx Document SetIndexWeights