S
S
Sergey2015-04-09 16:36:29
linux
Sergey, 2015-04-09 16:36:29

There is a simple sphinx config, why doesn't it work?

I am trying to configure php config to work in yii2.
So far, I'm just testing everything in the console and this is what I have, this is the config:

source selposts
{
        type                    = mysql

        sql_host                = localhost
        sql_user                = username
        sql_pass                = password
        sql_db                  = databasename
        sql_port                = 3306  # optional, default is 3306
        sql_query               = SELECT header, text FROM sel_posts WHERE header != 'NULL'

}

index posts
{
        source                  = selposts
        path                    = /var/lib/sphinx/selectner/posts
        charset_type            = utf-8
}


indexer
{
        mem_limit               = 128M
}


searchd
{
        listen                  = 9312
        listen                  = 9306:mysql41
        log                     = /var/log/sphinx/searchd.log
        query_log               = /var/log/sphinx/query.log
        read_timeout            = 5
        max_children            = 30
        pid_file                = /var/run/sphinx/searchd.pid
        max_matches             = 1000
        seamless_rotate         = 1
        preopen_indexes         = 1
        unlink_old              = 1
        workers                 = threads # for RT to work
        binlog_path             = /var/lib/sphinx/
}

And this is the result of the indexer posts command:
[email protected] [/var/lib/sphinx]# indexer posts
Sphinx 2.0.9-id64-release (rel20-r4115)
Copyright (c) 2001-2013, Andrew Aksyonoff
Copyright (c) 2008-2013, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/etc/sphinx/sphinx.conf'...
indexing index 'posts'...
WARNING: Attribute count is 0: switching to none docinfo
WARNING: source selposts: skipped 14 document(s) with zero/NULL ids
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.003 sec, 0 bytes/sec, 0.00 docs/sec
total 1 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 5 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
[email protected] [/var/lib/sphinx]#

The query result in phpmyadmin shows the correct one:
3fe77ecbcb9e45a3ad4e225a5e03e981.png
Why do I have 0 records? What is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Tarakhonich, 2015-04-09
@butteff

You must have an ID for each entry in order to work with sphinx.

sql_query = SELECT id, header, text FROM sel_posts WHERE header != 'NULL'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question