M
M
Madion2017-05-16 10:04:02
Sphinx
Madion, 2017-05-16 10:04:02

Sphinx - why is it not looking for Russian words with sql_query_pre in the config?

Hello dear experts!
There is this config:

source dbconnect
{
    type            = mysql
    sql_host        = localhost
    sql_user        = user
    sql_pass        = password
    sql_db          = dbname
    sql_port        = 3306
    sql_query_pre = SET NAMES utf8

    mysql_connect_flags = 32
}

source defaultindex : dbconnect
{
    sql_query_pre       = UPDATE tbl_sphinx_delta_counter SET \
last_id = (SELECT MAX(id) FROM tbl_product)

    sql_query           = SELECT id, name, description, keywords, meta_keywords \
FROM tbl_product WHERE \
id <= ( SELECT last_id FROM tbl_sphinx_delta_counter WHERE counter_id=1 )

    sql_field_string    = name
    sql_field_string    = description
    sql_field_string    = keywords_subscription
    sql_field_string    = meta_keywords

    sql_ranged_throttle = 0
}

source deltatindex : dbconnect
{
    sql_query           = SELECT id, name, description, keywords, meta_keywords \
FROM tbl_product WHERE \
id > ( SELECT last_id FROM tbl_sphinx_delta_counter WHERE counter_id=1 )

    sql_field_string    = name
    sql_field_string    = description
    sql_field_string    = keywords_subscription
    sql_field_string    = meta_keywords
}

index defaultsearch
{
    source            = defaultindex
    path              = /var/lib/sphinxsearch/data/product
    wordforms         = /var/lib/sphinxsearch/syns.txt
    morphology        = lemmatize_ru_all
    min_word_len = 2
    min_prefix_len = 1
    html_strip = 1
    index_exact_words = 1
    expand_keywords = 1
    mlock = 0
}

index deltasearch : defaultsearch
{
    source            = deltatindex
    path              = /var/lib/sphinxsearch/data/product_delta
}

With this config, sphinx only searches for English words. And in Russian is not looking.
But if I comment out the line:
sql_query_pre       = UPDATE tbl_sphinx_delta_counter SET last_id = (SELECT MAX(id) FROM tbl_product)

then the search works fine, both in English and in Russian words.
Why? And how to force to search in Russian words with this request?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Fortop, 2017-05-16
@Fortop

What do you think this line should do?

P
Puma Thailand, 2017-05-16
@opium

Why the hell do you even have this pre?
look in the end what last id you have.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question