Search code examples
sphinx

How get name of table in result array in Sphinx?


I use some indexes in one file sphinx.conf. When I give result array from these indexes(different tables Mysql) I don't get names of tables. How I can get it?


Solution

  • You can modify sql_query attribute of your indexes in sphinx.conf so they will return one fake attribute - index name.

    For example:

    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;