1

当 Sphinx 启动时,我收到以下警告:

警告:compat_sphinxql_magics=1 已弃用;请更新您的应用程序和配置 警告:索引“delta”:锁定:锁定失败 C:\Sphinx\conf\sphinx_test.spl:没有这样的文件或目录;索引不可用

配置文件

source main
    {
        ...MYSQL options...
        sql_query_pre   = UPDATE delta_index SET last_index_time = NOW() WHERE counter_id = 1;
        sql_query_pre   = SET @a := 0;
        sql_query_pre   = SET NAMES utf8
        sql_query       = \
            SELECT @a := @a + 1 AS id, m.message_id AS mid, user_see.user_id AS user_see_id, ms.message_stream_id AS msid, \
            d.name AS dname, m.text AS mtext, CONCAT(user_write.first_name, ' ', user_write.last_name) AS name, ms.subject AS subj \
            FROM message_stream AS ms \
            INNER JOIN message m \
            ON m.message_stream_id = ms.message_stream_id \
            INNER JOIN user user_write \
            ON m.user_id = user_write.user_id \
            INNER JOIN message_stream_has_basket mshb \
            ON ms.message_stream_id = mshb.message_stream_id \
            INNER JOIN basket b \
            ON mshb.basket_id = b.basket_id \
            INNER JOIN department d \
            ON b.department_id = d.department_id \
            INNER JOIN user_has_department uhd \
            ON uhd.department_id = d.department_id \
            INNER JOIN user user_see \
            ON uhd.user_id = user_see.user_id \
            WHERE (b.user_id IS NULL OR uhd.user_id = b.user_id \
            AND m.date_created <= (SELECT last_index_time FROM delta_index WHERE counter_id = 1))
        sql_attr_uint       = user_see_id
        sql_attr_uint       = mid
        sql_attr_uint       = msid
    }

    source delta : main
    {
        sql_query_pre   = SET NAMES utf8
        sql_query       = \
            SELECT @a := @a + 1 AS id, m.message_id AS mid, user_see.user_id AS user_see_id, ms.message_stream_id AS msid, \
            d.name AS dname, m.text AS mtext, CONCAT(user_write.first_name, ' ', user_write.last_name) AS name, ms.subject AS subj \
            FROM message_stream AS ms \
            INNER JOIN message m \
            ON m.message_stream_id = ms.message_stream_id \
            INNER JOIN user user_write \
            ON m.user_id = user_write.user_id \
            INNER JOIN message_stream_has_basket mshb \
            ON ms.message_stream_id = mshb.message_stream_id \
            INNER JOIN basket b \
            ON mshb.basket_id = b.basket_id \
            INNER JOIN department d \
            ON b.department_id = d.department_id \
            INNER JOIN user_has_department uhd \
            ON uhd.department_id = d.department_id \
            INNER JOIN user user_see \
            ON uhd.user_id = user_see.user_id \
            WHERE ((b.user_id IS NULL OR uhd.user_id = b.user_id) \
            AND m.date_created > (SELECT last_index_time FROM delta_index WHERE counter_id = 1))
        sql_attr_uint       = user_see_id
        sql_attr_uint       = mid
        sql_attr_uint       = msid
    }

    index main
    {
        source      = main
        path        = C:\Sphinx\conf\sphinx_test
        docinfo     = extern
        charset_type    = utf-8
        charset_table   = 0..9, A..Z->a..z, a..z, -, \
                        U+00C1->U+00E1, U+00C9->U+00E9, U+00CD->U+00ED, \
                        U+00D3->U+00F3, U+00D6->U+00F6, U+0150->U+0151, \
                        U+00DA->U+00FA, U+00DC->U+00FC, U+0170->U+0171, \
                        U+00E1, U+00E9, U+00ED, U+00F3, U+00F6, U+0151, \
                        U+00FA, U+00FC, U+0171
        min_word_len    = 2
        enable_star = 1
        min_prefix_len  = 2
    }

    index delta : main
    {
        source      = delta
        path        = C:\Sphinx\conf\sphinx_test
        docinfo     = extern
        charset_type    = utf-8
        charset_table   = 0..9, A..Z->a..z, a..z, -, \
                        U+00C1->U+00E1, U+00C9->U+00E9, U+00CD->U+00ED, \
                        U+00D3->U+00F3, U+00D6->U+00F6, U+0150->U+0151, \
                        U+00DA->U+00FA, U+00DC->U+00FC, U+0170->U+0171, \
                        U+00E1, U+00E9, U+00ED, U+00F3, U+00F6, U+0151, \
                        U+00FA, U+00FC, U+0171
        min_word_len    = 2
        enable_star = 1
        min_prefix_len  = 2
    }

    indexer
    {
        mem_limit       = 32M
    }

    # searchd options (used by search daemon)
    searchd{
        listen      = 9310
        log         = C:\Sphinx\conf\searchd.log
        query_log       = C:\Sphinx\conf\query.log
        max_children    = 30
        pid_file    = C:\Sphinx\conf\searchd.pid
    }

我正在运行 main+delta 索引,一切正常,搜索引擎正在搜索,我有正确的搜索结果。

C:\Sphinx\bin>indexer --config C:\Sphinx\conf\sphinx_test.conf main delta

之后我运行增量索引,索引有正确的文档(只有新文档),但搜索引擎失败,我没有结果。似乎 delta 覆盖了 main。(我正在搜索主要和增量)

C:\Sphinx\bin>indexer --config C:\Sphinx\conf\sphinx_test.conf delta

C:\Sphinx\bin>searchd --config C:\Sphinx\conf\sphinx_test.conf
4

0 回答 0