Sphinx返回完全错误的count()结果

时间:2014-04-23 09:50:24

标签: count sphinx

问题如下。我有索引哪个MySQL源包含4.5M +条目。 但count()查询在此索引中仅显示1.5M +条目。请参阅详细信息:

当我为此来源运行索引器时,我看到:

# indexer --rotate <index>

Sphinx 2.2.2-id64-beta (r4553)
Copyright (c) 2001-2014, Andrew Aksyonoff
Copyright (c) 2008-2014, Sphinx Technologies Inc ( http://sphinxsearch.com )

using config file '/usr/local/etc/sphinx.conf'...
indexing index '<index>'...
collected 4558763 docs, 552.5 MB
sorted 81.7 Mhits, 100.0% done
total 4558763 docs, 552512903 bytes
total 889.631 sec, 621058 bytes/sec, 5124.32 docs/sec
total 4561032 reads, 14.043 sec, 0.4 kb/call avg, 0.0 msec/call avg
total 5991 writes, 13.257 sec, 498.2 kb/call avg, 2.2 msec/call avg
rotating indices: successfully sent SIGHUP to searchd (pid=29227).

它说&#34;收集 4558763 docs,552.5 MB&#34;。

另一方面,当我运行计数查询时,我得到了这个:

sphinxQL> select * from <index> limit 0; show meta;
Empty set (0.14 sec)

+---------------+---------+
| Variable_name | Value   |
+---------------+---------+
| total         | 1000    |
| total_found   | 1570351 |
| time          | 0.072   |
+---------------+---------+
3 rows in set (0.00 sec)

或此查询(相同结果):

sphinxQL> select 1 as d, count(*) c from <index> group by d;
+------+---------+
| d | c |
+------+---------+
| 1 | 1570351 |
+------+---------+
1 row in set (0.15 sec)

所以看起来狮身人面像只发现 1.5M + 条目。怎么可能?也许我错过了什么?

1 个答案:

答案 0 :(得分:0)

  1. 您可以搜索&#34; max_matches&#34; sphinx.conf中的参数,可以在那里设置。
  2. 添加到查询&#34;选项&#34;串。查询将是这样的:

    从限制0选择* OPTION max_matches = 10000000

  3. 尝试这两个想法。