Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何知道Sphinx中检索到的表记录是什么?_Sphinx - Fatal编程技术网

如何知道Sphinx中检索到的表记录是什么?

如何知道Sphinx中检索到的表记录是什么?,sphinx,Sphinx,从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_na

从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
}
返回

{'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是空的?这是获取表名的正确方法吗?如果不是,是什么?

请确保在更改配置文件后重新生成索引

最好在更改配置后重新启动sphinx

在查询中指定实际索引名,而不是仅使用“*”—所有索引都应具有所需的属性

{'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})