real-timesphinxsphinxql

Sphinx wildcard match on realtime index


I have created realtime index:

index berni_filter2
{
    rt_mem_limit    = 512M
    type            = rt
    path            = /var/lib/sphinxsearch/data/berni_filter

    rt_attr_uint    = product_id
    rt_attr_uint    = store_id
    rt_field        = product_name
    rt_attr_json    = attributes

    prefix_fields   = product_name
    expand_keywords = 1
    min_infix_len   = 2
    dict            = keywords
}

Then I trying to get data by product name field over SphinxQL:

SELECT product_id FROM berni_filter2 WHERE store_id = 0 AND MATCH ('@product_name mothercare')

This query work fine, but I need to find partically words, for example "mother" must return products with "mothercare". I have tried:

SELECT product_id FROM berni_filter2 WHERE store_id = 0 AND MATCH ('@product_name mother')
SELECT product_id FROM berni_filter2 WHERE store_id = 0 AND MATCH ('@product_name mother*')
SELECT product_id FROM berni_filter2 WHERE store_id = 0 AND MATCH ('@product_name *mother*')

I tried change min_infix_len to min_prefix_len. Nothing work.


Solution

  • My mistake was, that I don't delete data files from filesystem, when change config, this is final working config:

    index berni_filter
    {
        rt_mem_limit    = 512M
        type            = rt
        path            = /var/lib/sphinxsearch/data/berni_filter
    
        rt_attr_uint    = product_id
        rt_attr_uint    = store_id
        rt_field        = product_name
        rt_attr_json    = attributes
    
        index_exact_words = 1
        expand_keywords   = 1
        min_prefix_len    = 3
        min_word_len      = 2
    
        morphology        = stem_enru
        dict              = keywords
    }