Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sphinx_Query failed: no enabled local indexes to search

Tags:

php

mysql

sphinx

Hi I configured sphinx search in my test server.

Now I am getting this kind of an error "Sphinx_Query failed: no enabled local indexes to search".

I am not getting why this error. Any body can help me plese.

This is my sphinx conf

source objectcollection
{
    type                    = mysql
    sql_host                = localhost
    sql_user                = root
    sql_pass                = root
    sql_db                  = mydatabase
    sql_port                = 3306  

    sql_query                       = \
        SELECT id, id as mid  obtype_id, searchtext from tab_objectcollection;

    sql_attr_uint           = mid
    sql_attr_uint           = obtype_id
    sql_query_info      = SELECT * FROM tab_objectcollection WHERE id=$id

}


index combinedobject
{
    source              = objectcollection
    path                = /usr/local/sphinx/var/data/objectcollection
    morphology          = stem_en
    min_stemming_len    = 4
    stopwords           = /usr/local/sphinx/var/data/stopwords.txt
    min_word_len        = 3
    min_prefix_len      = 3
    min_infix_len       = 0
    enable_star         = 1
    phrase_boundary = ., ?, !, U+2026 # horizontal ellipsis
    phrase_boundary_step = 100
    html_strip = 1

}


indexer
{
        # memory limit, in bytes, kiloytes (16384K) or megabytes (256M)
        # optional, default is 32M, max is 2047M, recommended is 256M to 1024M
        mem_limit = 256M

        # maximum xmlpipe2 field length, bytes
        # optional, default is 2M
        #
        max_xmlpipe2_field = 16M


        # write buffer size, bytes
        # several (currently up to 4) buffers will be allocated
        # write buffers are allocated in addition to mem_limit
        # optional, default is 1M
        #
        #write_buffer = 16M
}

searchd
{
    listen              = 3312
    max_matches         = 10000
    log                 = /usr/local/sphinx/var/log/searchd.log
    query_log           = /usr/local/sphinx/var/log/query.log
    pid_file            = /usr/local/sphinx/var/log/searchd.pid
}

Thanks

like image 923
DEVOPS Avatar asked Dec 20 '22 22:12

DEVOPS


2 Answers

Have you

  1. Actully built the index - ie called 'indexer' program, to make the index files.
  2. Started the Search Daemon - searchd
like image 84
barryhunter Avatar answered Jan 17 '23 18:01

barryhunter


I think this error means that sphinx can't find the file(s) specified by "path" in your index. In my case I had:

path = /var/lib/sphinxsearch/data/delta

And I had ran the indexer successfully (or so I thought) like this:

indexer delta --rotate

It said there were some documents collected. HOWEVER it actually created these files:

/var/lib/sphinxsearch/data/delta.new.sp?

And searchd failed to rotate the files. Thus spake the log:

WARNING: rotating index 'delta': rename '/var/lib/sphinxsearch/data/delta.mvp' to '/var/lib/sphinxsearch/data/delta.old.mvp' failed: No such file or directory

The solution was: delete those new files and run indexer without --rotate the first time.

The fact that --rotate doesn't work the first time seems like a bit of a bug to me, but I can't really be bothered to submit a bug report. It probably requires me to register or some nonsense. Anyway, hope this helps.

like image 23
Timmmm Avatar answered Jan 17 '23 18:01

Timmmm