我创建了一个索引:
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。什么都不管用。
我的错误是我在更改配置后没有从磁盘中删除索引。工作最终配置: