Dingo
Dingo

Reputation: 2706

Sphinx search exact match

In my index in SphinxSearch I would like on first position exact match of search phase. But I got exact math on ~ 6th position.

For example:

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

returns [sphinxsearch result]

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

but source data is [mysql result]

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

Note, that record with id 58449 is the exact math.

We use version 2.1.6 of sphinxsearch.

Upvotes: 1

Views: 703

Answers (1)

barryhunter
barryhunter

Reputation: 21081

I guessing you have enable_star=0 yes? http://sphinxsearch.com/docs/archives/manual-2.1.6.html#conf-enable-star

would suggest changing to enable_star=1, and then add expand_keyword=1 http://sphinxsearch.com/docs/archives/manual-2.1.6.html#conf-expand-keywords

This should allow you to rank exact matches higher. Might need to experiment with different ranking expressions. http://sphinxsearch.com/docs/archives/manual-2.1.6.html#weighting

Upvotes: 1

Related Questions