使用Sphinx,从多个索引,通过PHP脚本搜索特定索引

编程入门 行业动态 更新时间:2024-10-08 06:19:02
本文介绍了使用Sphinx,从多个索引,通过PHP脚本搜索特定索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有多个来源,比如说(比如说)

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脚本搜索特定索引

本文发布于:2023-11-28 20:23:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643827.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:索引   多个   脚本   Sphinx   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!