实时索引上的 Sphinx 通配符匹配
Sphinx wildcard match on 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
}
然后我尝试通过 SphinxQL 按产品名称字段获取数据:
SELECT product_id FROM berni_filter2 WHERE store_id = 0 AND MATCH ('@product_name mothercare')
此查询工作正常,但我需要查找部分单词,例如 "mother" 必须 return 产品与 "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。没有任何效果。
我的错误是,我没有从文件系统中删除数据文件,当更改配置时,这是最终的工作配置:
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
}
我遇到了同样的问题。删除索引文件也对我有帮助。
在删除之前,我停止了 searchd 服务,然后重新启动它。
我已经创建了实时索引:
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" 必须 return 产品与 "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。没有任何效果。
我的错误是,我没有从文件系统中删除数据文件,当更改配置时,这是最终的工作配置:
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
}
我遇到了同样的问题。删除索引文件也对我有帮助。 在删除之前,我停止了 searchd 服务,然后重新启动它。