I use coreseek 4.1 on centos6.5. coreseek config file like that:
sql_query = select id,username,ordersn,addtime from order where ispay=1;
I what to select users who's order num > 10 between some time.
That's my code:
$s = new SphinxClient;
$s->setServer("localhost", 9312);
$s->setArrayResult(true);
$s->SetGroupDistinct("ordersn");
$s->SetGroupBy("username",SPH_GROUPBY_ATTR);
$s->SetFilterRange("@distinct", 10, 999999);
$result = $s->query('', 'my_index');
But it return null.when i remove $s->SetFilterRange("@distinct", 10, 999999);
it return 1261 total_found,some resut like that:
[18] => Array
(
[id] => 238041
[weight] => 1
[attrs] => Array
(
[ordersn] => 0
[username] => 0
[addtime] => 1448959834
[@groupby] => 8980267602450089129
[@count] => 20
[@distinct] => 28
)
)
It meas that there is someone's ordernum > 10.But how cound i find them by sphinx(coreseek)?
This should be possible in SphinxQL:
SELECT *,COUNT(DISTINCT ordersn) AS orders FROM my_index GROUP BY user HAVING orders >= 10
which has a 'HAVING' clause, since 2.2.1-beta. (I think coreseek 5 is based on?)
As far as I am aware this has never been added to the SphinxAPI.