W
W
webivan12017-01-28 12:00:40
Sphinx
webivan1, 2017-01-28 12:00:40

How to properly configure sphinx config?

Hello!
There is a debian server, installed sphinx /etc/sphinxsearch/ I
went into my project on Yii 2 in the config folder and created a sphinx.conf
file in which:

source films
{
        type                    = mysql

        sql_host                = localhost
        sql_user                = ***
        sql_pass                = ***
        sql_db                  = ***
        sql_query_pre           = SET NAMES utf8

        sql_query               = SELECT id, h2, text_not_index, keyname FROM films
}

indexer
{
    mem_limit           = 256M
}

index films
{
        source                  = films
        path                    = /var/lib/sphinxsearch/data/****
        charset_type    = utf-8
        morphology        = stem_enru
        min_word_len   = 2
        charset_table  = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F, U+401->U+451, U+451
        blend_chars    = &, ., +, U+23
        min_infix_len  = 2
        enable_star    = 1
        index_exact_words = 1
        html_strip     = 1
}

searchd
{
        listen            = localhost:9306:mysql41
}

Launched the indexer /usr/bit/indexer --all
Everything worked OK.
Then I downloaded yii2-sphinx from composer and configured the config:
'sphinx' => [
            'class' => 'yii\sphinx\Connection',
            'dsn' => 'mysql:host=localhost;port=9306;dbname=***',
            'username' => '***',
            'password' => '***,
        ],

I wrote action in the controller
public function actionSphinx() {
                $query = new \yii\sphinx\Query;
                echo '</pre>';
                print_r($query->from('films')->match('Dead')->all());
                exit;
        }

Displays an error moovie.pro/api/sphinx
Please help me to configure sphinx correctly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Puma Thailand, 2017-01-28
@opium

Well, you drive your requests from the console with your hands

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question