我创建了实时索引:
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。没有任何工作。