我创建了实时索引:
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')
此查询工作正常,但我需要找到部分单词,例如" mother"必须退回产品" 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 :(得分: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
}
答案 1 :(得分:0)
我遇到了同样的问题。删除索引文件对我也有帮助。 在删除之前,我停止了 searchd 服务,然后重新启动它。