2014-04-22 65 views
1

我試圖讓主索引sql_query_killlist工作,但無論我做什麼,刪除的文件仍然出現是SphinxQL結果。我的獅身人面像版本是2.0.4。在的sphinx.conf文件獅身人面像sql_query_killlist被忽略

部分:

source torrents 
{ 
    type  = mysql 

    sql_host  = localhost 
    sql_user  = torrents 
    sql_pass  = torrents 
    sql_db  = torrents 
    sql_port  = 3306 
    sql_sock  = /var/run/mysqld/mysqld.sock 

    sql_query_range  = SELECT MIN(id), MAX(id) FROM torrents 
    sql_range_step  = 1000 
    sql_query   = \ 
          SELECT torrents.id, torrents.id, text_data.torrent, language_id, category, title, words, HEX(torrents.code) as code, sum(trackers_torrents.seeds) as seeds, sum(trackers_torrents.peers) as peers, size, creation_date, rating FROM `text_data` \ 
          LEFT JOIN `torrents` ON torrents.id = text_data.torrent \ 
          LEFT JOIN `trackers_torrents` ON trackers_torrents.torrent = torrents.id \        
          WHERE text_data.torrent >= $start AND text_data.torrent <= $end \ 
          AND `trackers_torrents`.status = 'ok' AND `torrents`.is_stopword = 0 \ 
          GROUP BY text_data.torrent \ 
          ORDER BY text_data.torrent ASC \ 

    sql_attr_uint = torrent 
    sql_attr_uint  = language_id 
    sql_attr_string  = title 
    sql_field_string = words 
    sql_attr_string = code 
    sql_attr_uint  = seeds 
    sql_attr_uint  = peers 
    sql_attr_uint = category 
    sql_attr_bigint  = size 
    sql_attr_bigint = creation_date 
    sql_attr_uint = rating 

    sql_query_pre = SET NAMES utf8 
    sql_query_pre = SET SESSION query_cache_type=OFF 

    sql_query_killlist = SELECT torrent_id FROM stopwords_torrents 
} 

這是關鍵線路:

sql_query_killlist = SELECT torrent_id FROM stopwords_torrents 

stopwords_torrents表看起來像這樣:

mysql> select * from stopwords_torrents; 
+----+------------+ 
| id | torrent_id | 
+----+------------+ 
| 2 |  14115 | 
+----+------------+ 
1 row in set (0.00 sec) 

當你去到SphinxQL

mysql -h 0 -P 9306 

,並鍵入此,我仍然可以刪除文件。這是什麼?

mysql> select id, torrent, code from all_torrents WHERE id = 14115; 
+-------+--------+---------+------------------------------------------+-------+ 
| id | weight | torrent | code          | id | 
+-------+--------+---------+------------------------------------------+-------+ 
| 14115 |  1 | 14115 | 4956A4E976EA948025C3C3554567CA2820F65F64 | 14115 | 
+-------+--------+---------+------------------------------------------+-------+ 
1 row in set (0.00 sec) 

回答

2

一個索引上的kill-list,從以前的索引中刪除文檔。不是當前的指數。

它用於查詢多個索引時。搜索一個索引時不起作用。

如果您想從結果中刪除文檔,只需修改sql_query以直接排除它們。