Sphinx 搜索完全匹配

Sphinx search exact match

在我的 SphinxSearch 索引中,我希望搜索阶段的第一个位置完全匹配。但我在 ~ 6th 位置得到了精确的数学。

例如:

SELECT id, WEIGHT()
FROM `products_elit_cs`
WHERE MATCH('BKR5EK') 
ORDER BY WEIGHT() DESC
OPTION ranker=sph04

returns [sphinx搜索结果]

id  weight()
199001  7528
279018  7528
385989  7528
4513542 7528
4759603 7528
58449   7527
297335  6528
4759601 6527
5030474 6527
341879  4527

但源数据是 [mysql 结果]

id  active_number_cs
58449   BKR5EK
199001  BKR5EKU
279018  BKR5EKUP
297335  BKR5EKB-11
341879  V-23 BKR5EK
385989  BKR5EKC
4513542 BKR5EKUD
4759601 BKR5EKPB-13
4759603 BKR5EKUC
5030474 BKR5EKPB-11

请注意,id 为 58449 的记录是精确的数学运算。

我们使用 2.1.6 版的 sphinxsearch。

我猜你有 enable_star=0 是吗? http://sphinxsearch.com/docs/archives/manual-2.1.6.html#conf-enable-star

建议改成enable_star=1,然后加上expand_keyword=1 http://sphinxsearch.com/docs/archives/manual-2.1.6.html#conf-expand-keywords

这应该可以让您获得更高的完全匹配排名。可能需要尝试不同的排名表达式。 http://sphinxsearch.com/docs/archives/manual-2.1.6.html#weighting