Search code examples
phpsearchconfigurationsphinx

How to set group by for multiple fields in sphinx config source sql


I need to set group by for multiple fields in my sphinx config source sql.

select f1,f2,f3,f5 from table group by f2,f3,f5;

Like this I need sql

for that I created source like this

source myindex
{
    type            = mysql

    sql_host        = localhost
    sql_user        = root
    sql_pass        = root
    sql_db          = mydb
    sql_port        = 3306  # optional, default is 3306
    sql_query = \
    select f1,f2,f3,f4 from table;

    sql_group_column = f2;
    sql_group_column = f3;
    sql_group_column = f4;

}

My I know my config file is correct or not?

WARNING: key 'sql_group_column' is deprecated in /etc/sphinx/sphinx.conf line 27; use 'sql_attr_uint' instead

My sphinx version is 204. Now I am getting this error while rotating my index.


Solution

  • Change

    sql_group_column = f2;
    sql_group_column = f3;
    sql_group_column = f4;
    

    To

    sql_attr_uint = f2;
    sql_attr_uint = f3;
    sql_attr_uint = f4;
    

    Or to different attribute type f2, f3, f4 uses Sphinx attributes