2017-02-16 100 views
0

我已经创建实时指数:狮身人面像通配符匹配

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 
} 

然后我试图在SphinxQL得到按产品名称场数据:

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

这个查询做工精细,但我需要找到一些言辞单调的词语,例如“母亲”必须将产品返还给“mothercare”。我曾尝试过:

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*') 

我试着将min_infix_len更改为min_prefix_len。没有用。

+0

当你说你改变了'min_index_len'等,你是怎么改?您无法即时更改大多数索引设置。需要删除索引,更改配置,然后重建索引(再次插入所有数据)。还要注意''prefix_fields'不适用于RT索引(或更正确的'dict = keywords')。你也有'expand_keywords = 1',所以不应该需要手动添加星星(即第一个例子应该工作) – barryhunter

+0

是的,我的错误是,我没有从文件系统中删除数据文件。 – gvozd1989

回答

0

我的错误是,我不从文件系统,当改变配置删除数据文件,这是最后的工作配置:

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 
} 
相关问题