dpm91915 2015-05-22 05:20
浏览 86
已采纳

Sphinx在php api中通过第二个id过滤

im facing a problem since weeks, i cannot filter my search results by an second id

here is my source

source src1
{
type = mysql
sql_host = ****
sql_user = ****
sql_pass = ****
sql_db = ****
sql_port = 3306 # optional, default is 3306
sql_query_range = SELECT MIN(id),MAX(id) FROM ***
sql_range_step = 100000
sql_query = \
SELECT id,sid,nume,durata,hits, UNIX_TIMESTAMP(data) AS data \
FROM *** WHERE id>=$start AND id<=$end AND img_down='1' AND cat='0'

sql_attr_float = sid
sql_attr_float = durata
sql_attr_float = hits
sql_attr_float = data
}

here is my php code :

$array = Array(4,5,6,7,8,9,15,17,19,21,22,23,24,25,26,29,32,33,37,39,41,45,48,51,52,55,56,58,62,63,72);
$i->SetMatchMode(SPH_MATCH_ANY);
$i->setSortMode(SPH_SORT_EXTENDED,'@relevance DESC, hits DESC, data DESC');
$i->SetFilter('sid', $array);

So everytime when i´m running the script i become in SphinxTools this error message:

 /* error=index test1: unsupported filter type 'intvalues' on float column */

so ive tryied with $i->setFilterFloatRange but then i become nothing also tryied with $i->SetFilterRange but nothing happens, i mean i become no error message just 0 results

Thank you

  • 写回答

1条回答 默认 最新

  • doujiu8479 2015-05-22 06:46
    关注

    There is no need to index all fields as floats. My guess is id, sid and most probable hits too are integer fields.

    sql_attr_uint = sid
    sql_attr_uint = durata
    sql_attr_uint = hits
    sql_attr_uint = data
    

    To define as integer fields. Filtering should work a lot better this way

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?