artyomboyko
artyomboyko

Reputation: 2871

Sphinx sql_query_killlist is ignored

I'm trying to get main index sql_query_killlist to work, but no matter what I do, deleted documents are still appear is SphinxQL results. My sphinx version is 2.0.4.

Part of the sphinx.conf file:

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
}

This is the key line:

sql_query_killlist  = SELECT torrent_id FROM stopwords_torrents

My stopwords_torrents table looks like this:

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

When you go into SphinxQL

mysql -h 0 -P 9306

And type this, I still get deleted document. Whys is this ?

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)

Upvotes: 1

Views: 426

Answers (1)

barryhunter
barryhunter

Reputation: 21091

A kill-list on a index, removes documents from PREVIOUS indexes. Not the current index.

Its for when querying multiple indexes. It will have no effect when searching one index.

If you want to remove the documents from the results, just modify sql_query to directly exclude them.

Upvotes: 2

Related Questions