dongmi1872 2012-01-16 04:25
浏览 47
已采纳

Sphinx根据排序返回不一致的结果集

I'm trying to implement multilingual indexes for the web application I'm developing. At the moment, records exist in a few languages, English, Malay & Arabic (but they are not separated into different columns). Only English stemmer is currently enabled.

Only two indexes are built, for the stemmed and the non-stemmed indexes. I'm having the problem with the stemmed index, as the result set returned is not consistent, depending on the sort column.

These two queries (from the stemmed index), each returns a different number of total results, although the difference between them is only the sort order.

SELECT * FROM test1stemmed WHERE MATCH('@institution universiti') GROUP BY art_id ORDER BY art_title_ord ASC;

SELECT * FROM test1stemmed WHERE MATCH('@institution universiti') GROUP BY art_id ORDER BY art_title_ord DESC;

However, if the same queries were run on the non-stemmed index, the numbers of results are equal.

I'm also having the same problem with Sphinx PHP API:

$sp = new SphinxClient();
$sp->SetServer('localhost', 9312);
$sp->SetMatchMode(SPH_MATCH_EXTENDED);
$sp->SetGroupBy('art_id', SPH_GROUPBY_ATTR, "$sp_sort_column $sort");
$sp->SetLimits($offset, $rows_per_page, 1000);
$sp->Query("$q", 'test1stemmed');

What am I missing?

  • 写回答

1条回答 默认 最新

  • douxiu6835 2012-01-17 08:03
    关注

    Something that I missed from the documentation here http://sphinxsearch.com/docs/2.0.2/clustering.html

    WARNING: grouping is done in fixed memory and thus its results are only approximate; so there might be more groups reported in total_found than actually present. @count might also be underestimated. To reduce inaccuracy, one should raise max_matches. If max_matches allows to store all found groups, results will be 100% correct.

    So I can workaround this by increasing the value in max_matches, but since putting a very large value is absolutely undesirable, I would fix the query instead.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用