我在使用 Sphinx 搜索索引时遇到问题。我不断从中得到空的结果集。
source mrc
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = test_db
sql_port = 3306
mysql_connect_flags = 32
sql_query_pre = SET NAMES latin1
sql_query_pre = SET SESSION query_cache_type=OFF
sql_query_pre = REPLACE INTO sphinx.indexer (idx,server,version,lastrun_at) SELECT 'mrc','localhost','2.0.4',UNIX_TIMESTAMP(NOW()) FROM DUAL
sql_query_post = UPDATE sphinx.indexer SET fetched_by = UNIX_TIMESTAMP(NOW()) WHERE idx = 'mrc' AND server = 'localhost' AND version = '2.0.4'
sql_query_post_index = UPDATE sphinx.indexer SET indexed_by = UNIX_TIMESTAMP(NOW()) WHERE idx = 'mrc' AND server = 'localhost' AND version = '2.0.4'
sql_attr_uint = mrc_id
sql_attr_uint = mrc_parent
sql_attr_float = mrc_latitude
sql_attr_float = mrc_longitude
sql_query = \
SELECT mrc_id AS doc_id, \
mrc_id, \
mrc_parent, \
RADIANS(mrc_latitude) as mrc_latitude, \
RADIANS(mrc_longitude) as mrc_longitude \
FROM mrc_table \
WHERE mrc_parent > 0
sql_query_info = SELECT * FROM mrc_table WHERE mrc_id = $id
}
index mrc
{
charset_type = sbcs
docinfo = extern
mlock = 1
morphology = none
source = mrc
path = /usr/local/var/data/mrc
}
索引器给了我-
indexing index 'member_region_cities'...
collected 78312 docs, 0.0 MB
total 78312 docs, 0 bytes
total 0.656 sec, 0 bytes/sec, 119354.57 docs/sec
如果我通过 mysql 连接到 searchd 并执行
SELECT * FROM mrc_table;
它返回空。
本地主机表中肯定有数据,您可以在索引器显示“已收集 78312”的位置看到它
那么为什么 Sphinx 不将数据放入 searchd 中呢?
干杯