来自 sphinx.conf:
source src0 {
type = pgsql
sql_host = localhost
sql_user = <db user>
sql_pass = <pwd>
sql_db = <db name>
sql_port = 5432
sql_query = \
SELECT id, header, text, "app_main" as table_name \
FROM app_main
sql_query_info = SELECT * FROM app_main WHERE id=$id
sql_attr_string = table_name
}
source src1 {
type = pgsql
sql_host = localhost
sql_user = <db user>
sql_pass = <pwd>
sql_db = <db name>
sql_port = 5432
sql_query = \
SELECT id, header, text, "app_product" as table_name \
FROM app_product
sql_query_info = SELECT * FROM app_product WHERE id=$id
sql_attr_string = table_name
}
index global_index {
source = src0
source = src1
path = D:/blizzard/Projects/Python/Web/moz455/app/sphinx/data/global_index
docinfo = extern
charset_type = utf-8
}
命令
client.Query(S, '*')
返回
{'status': 0, 'matches': [{'id': 5, 'weight': 30, 'attrs': {}}], 'fields': ['header', 'text'], 'time': '0.000', 'total_found': 1, 'warning': '', 'attrs': [], 'words': [{'docs': 1, 'hits': 2, 'word': 'styless'}], 'error': '', 'total': 1})
为什么 attrs dict 是空的?这是获取表名的正确方法吗?如果不是,那是什么?