2012-01-25 72 views
2

建立索引時我得到這個錯誤:思考斯芬克斯:另一個指數錯誤

indexing index 'qtl_table_core'... 
ERROR: index 'qtl_table_core': sql_range_query: 'soybase.qtl_table.QTLName' isn't in GROUP BY (DSN=mysql://_www:***@xxxxxxx/soybase). 

我的模型:

class QtlTable < ActiveRecord::Base 
    .... 
    define_index do 
    indexes :QTLID, :sortable => true 
    indexes :QTLName, :sortable => true 
    end 

development.sphinx.conf

indexer 
{ 
} 

searchd 
{ 
    listen = 127.0.0.1:1234 
    log = /usr/home/benjamin/qtl/log/searchd.log 
    query_log = /usr/home/benjamin/qtl/log/searchd.query.log 
    pid_file = /usr/home/benjamin/qtl/log/searchd.development.pid 
} 

source qtl_table_core_0 
{ 
    type = mysql 
    sql_host = xxxxxxxxxxxxxx 
    sql_user = _www 
    sql_pass = 
    sql_db = soybase 
    sql_query_pre = SET NAMES utf8 
    sql_query_pre = SET TIME_ZONE = '+0:00' 
    sql_query = SELECT SQL_NO_CACHE `qtl_table`.`QTLID` * CAST(1 AS SIGNED) + 0 AS `QTLID` , `qtl_table`.`QTLID` AS `QTLID`, `qtl_table`.`QTLName` AS `QTLName`, `qtl_table`.`QTLID` AS `sphinx_internal_id`, 0 AS `sphinx_deleted`, 1786069111 AS `class_crc`, IFNULL(`qtl_table`.`QTLID`, '') AS `QTLID_sort`, IFNULL(`qtl_table`.`QTLName`, '') AS `QTLName_sort` FROM `qtl_table` WHERE (`qtl_table`.`QTLID` >= $start AND `qtl_table`.`QTLID` <= $end) GROUP BY `qtl_table`.`QTLID` ORDER BY NULL 
    sql_query_range = SELECT IFNULL(MIN(`QTLID`), 1), IFNULL(MAX(`QTLID`), 1) FROM `qtl_table` 
    sql_attr_uint = sphinx_internal_id 
    sql_attr_uint = sphinx_deleted 
    sql_attr_uint = class_crc 
    sql_attr_str2ordinal = QTLID_sort 
    sql_attr_str2ordinal = QTLName_sort 
    sql_query_info = SELECT * FROM `qtl_table` WHERE `QTLID` = (($id - 0)/1) 
} 

index qtl_table_core 
{ 
    source = qtl_table_core_0 
    path = /usr/home/benjamin/qtl/db/sphinx/development/qtl_table_core 
    charset_type = utf-8 
    min_infix_len = 1 
    enable_star = 1  
} 

index qtl_table 
{ 
    type = distributed 
    local = qtl_table_core 
} 

回答

1

嘗試增加內以下您的define_index區塊:

group_by "`qtl_table`.`QTLName`" 
+0

很久以前我想到了這一點,剛纔注意到你提供了正確的答案:)給你的積分 – bdeonovic