I’m actully wanting to compare the field length the lccs, not with the query length.
It’s a kind of prospective search (for various reasons not using an actual percolate index)
Its actully with ‘quorum’ to make like a ‘match any’ query.
This is more complete demo, (still a bit simplified)
sphinxQL>select id,tag,tag_len,weight() from tagsk
where match('"looking towards black Mountains see sky"/1')
option ranker=expr('sum(lcs=tag_len)*bm25'), field_weights=(tag=10), morphology=none;
+--------+---------------------+---------+----------+
| id | tag | tag_len | weight() |
+--------+---------------------+---------+----------+
| 35260 | Black House | 2 | 549 |
| 248464 | Black Notley | 2 | 549 |
| 4164 | Black Mountains | 2 | 545 |
| 28323 | Grove Farm | 2 | 529 |
| 28419 | Bruisyard Wood | 2 | 529 |
| 28449 | Martins Farm | 2 | 529 |
| 28538 | Wolsey Cottages | 2 | 529 |
| 28656 | Spexhall Crossroads | 2 | 529 |
| 29000 | Sun Corner | 2 | 529 |
| 29039 | Ash Road | 2 | 529 |
| 29295 | Fir Pits | 2 | 529 |
| 29391 | Englishes Lane | 2 | 529 |
| 29399 | High Street | 2 | 529 |
| 29461 | Friday Street | 2 | 529 |
| 29544 | Potash Farm | 2 | 529 |
| 29564 | Little Glemham | 2 | 529 |
| 29726 | Nollers Lane | 2 | 529 |
| 29740 | Campsea Ashe | 2 | 529 |
| 29849 | Wangford Road | 2 | 529 |
sphinxQL>select id,tag,tag_len,weight() from tagsk
where match('"looking towards black Mountains see sky"/1')
option ranker=expr('sum(if(user_weight=10,lcs=tag_len,0))*bm25'), field_weights=(tag=10), morphology=none;
+--------+-------------------+---------+----------+
| id | tag | tag_len | weight() |
+--------+-------------------+---------+----------+
| 4164 | Black Mountains | 2 | 545 |
| 3427 | mountains | 1 | 525 |
| 6191 | Sky | 1 | 524 |
| 4767 | black | 1 | 519 |
| 410 | grey sky | 2 | 0 |
| 447 | Black five | 2 | 0 |
| 465 | blue | 1 | 0 |
| 1060 | Air, Sky, Weather | 3 | 0 |
| 1932 | black and white | 3 | 0 |
| 2494 | black death | 2 | 0 |
| 3693 | black isle | 2 | 0 |
| 3717 | blue sky | 2 | 0 |
| 4591 | the Black Burn | 3 | 0 |
| 5434 | see-saw | 2 | 0 |
This second one, is much better at picking out tags that actually exist in the ‘query’.