如何在 Sphinx 的结果数组中获取 table 的名称?

How get name of table in result array in Sphinx?

我在一个文件中使用了一些索引sphinx.conf。当我从这些索引(不同的表 Mysql)中给出结果数组时,我没有得到表的名称。我怎样才能得到它?

您可以在 sphinx.conf 中修改索引的 sql_query 属性,这样它们将 return 一个假属性 - 索引名称。

例如:

first_idx:
...
sql_query = SELECT <...>, 'first_idx' as index_name FROM fisrt_table;


second_idx:
...
sql_query = SELECT <...>, 'second_idx' as index_name FROM second_table;