Closed lyongdee closed 8 years ago
您说的是在正常多字段排序时这样没有问题的,a一样时才考虑b。 但是mysql还有一种排序是两个字段相加后再进行排序,xunsearch可以支持这种方式吗,我们的项目正在使用xunsearch,貌似sphinx可以支持。
那就变通一下,所谓的计算权重不可能有固定的模式啊。
变通后生成一个字段来存放,表示顺序
Best Regards
hightman/海鳗
微信/微博:hightman Github:https://github.com/hightman
在 2015年9月18日,下午1:14,Cola Luo notifications@github.com 写道:
您说的是在正常排序是这样没有问题的,a一样考虑b,但是mysql还有一种排序是两个字段相加再后进行,xunsearch可以支持这种方式吗,实际项目中会遇到这种情况的,貌似sphinx可以支持。
— Reply to this email directly or view it on GitHub https://github.com/hightman/xunsearch/issues/20#issuecomment-141347156.
嗯,是的,现在是这样处理的。
我目前也碰到这样的问题。
sphinx支持SPH_SORT_EXTENDED
支持权值计算,比如:
最近的一天发布的文章,10分,两天内的,5分,一周内的,1分。 被点赞超过>10次的,10分,>5次的,8分,>1次的,1分 距离发贴者位置100米的,10分,1000米的,5分,10000米的1分。 ...更多组合排序条件
最终按照计算总值排序
sphinx中可以做到这样计算排序。不知道xunsearch有没有这样的功能?
就是 setMultiSort ,怎么不行。前提是 a 一样才考虑 b 啊。
Best Regards
hightman/海鳗
微信/微博:hightman Github:https://github.com/hightman