tags:

views:

56

answers:

1

Hi, I have a pb with my declaration of sql_attr_multi in my Sphinx conf. I set :

sql_attr_multi  = uint surface_bien from ranged-query;      \
        SELECT annonce_id AS id, surface_bien FROM ann_info \
        WHERE surface_bien BETWEEN $start AND $end;     \
        SELECT MIN(id),MAX(id) FROM ann_info    

When I update my indexes sphinx return

ERROR: index 'ann_annonce': sql_range_step=0: must be positive.

I don't know where the error come from.

I try to set sql_range_step in the source behind the sql_attr_multi.

My source like

source ann_annonce : Immo
{
    sql_query = SELECT id, * FROM ann_annonce;

    sql_range_step = 1000
    sql_attr_multi  = uint surface_bien from ranged-query;      \
                     SELECT annonce_id AS id, surface_bien FROM ann_info \
                     WHERE surface_bien BETWEEN $start AND $end;        \
                     SELECT MIN(id),MAX(id) FROM ann_info                                   

    sql_range_step = 1000

    sql_attr_multi  = uint option_id from query;    \
                      SELECT annonce_id AS id, option_id FROM ann_option_index;


    sql_query_info  = SELECT * FROM ann_annonce WHERE id = $id;
}

thx.

A: 

I've got a similar problem and got it solved by using ranged query for both: index and document queries.

Instead of:

sql_query = SELECT id, * FROM ann_annonce;

use:

sql_query_range = SELECT MIN(id),MAX(id) FROM ann_annonce

sql_query = SELECT id, * FROM ann_annonce WHERE id>=$start and id<=$end;

After this it stops complaining about the range and attributes get indexed as well. Looks like a bug in sphinx.

Your question is a bit old, but hopefully people this solution useful.

Andriy Bohdan

related questions