使用Sphinx,从多个索引,通过PHP脚本搜索特定索引 [英] Searching a particular index using Sphinx, from multiple indexes, through PHP script
问题描述
我有多个来源,比如说(比如说)
I have multiple sources, like this (say)
source src1{
...
}
source src2{
...
}
AND
index src1 {
...
}
index src2 {
...
}
AND index src1{ ... } index src2{ ... }
src1有来自一个表的sql查询,而src2有基于另一个表的sql查询。
src1 has sql query from one individual table and src2 has sql query based on another individual table.
现在,在PHP脚本中,我该如何指定,使用哪个索引器?
通常,在PHP脚本中,我们这样写它
Now, in the PHP script, how do I specify, which indexer to use? Normally, in the PHP script, we write it this way
$ss = new SphinxClient;
$ss->setServer("localhost", 9312);
$ss->setMatchMode(SPH_MATCH_ANY);
因为没有提及正在使用的索引器。搜索两个索引(即两个表)都没用。我想搜索索引src2(比如说),即来自第二个表的数据。那么,我如何在我的php脚本中指定这一点,sphinx应该只搜索那个特定的索引器。
Since, there is no mention about the indexer being used. It's useless to search both indexes (i.e., both tables). I want to search the index src2(say) i.e., data from the second table. So, how do I specify this in my php script, that sphinx should search only that particular indexer.
推荐答案
查询调用包括要搜索的索引
The Query call includes the index(s) to search
$res = $cl->Query($query,"src1");
这篇关于使用Sphinx,从多个索引,通过PHP脚本搜索特定索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!