Jay
Jay

Reputation: 782

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{ ... }

src1 has sql query from one individual table and src2 has sql query based on another individual table.

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);

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.

Upvotes: 2

Views: 1814

Answers (2)

Michel Beaussart
Michel Beaussart

Reputation: 111

For one index (per Barry Hunter)

$res = $cl->Query($query,"src1"); 

or

For multiple indexes for one query.

$res = $cl->Query($query,"src1 src2 src3 src4");

Upvotes: 1

barryhunter
barryhunter

Reputation: 21091

The Query call includes the index(s) to search

$res = $cl->Query($query,"src1");

Upvotes: 3

Related Questions