manticoresearch
manticoresearch copied to clipboard
Ability to apply lcs to multiple-matches query via API
Proposal:
Currently, lcs can only apply to one match query which contains all keywords, multiple separate matches:
$ mysql -P9306 -se 'select content from pile_test'
content
lurks torture
What
torture
What is
$ curl -X POST 'http://localhost:9308/search' --data '{
"index": "pile_test",
"query": {"bool": {"must": [{"bool": {"should": [{"match": {"content": {"query": "lurks"}}}, {"match": {"content": {"query": "torture"}}}]}}]}},
"options": {
"ranker": "expr('\''1000 * top(lcs)'\'')"
}
}' | jq '.hits.hits[] | ._score'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1245 100 1002 100 243 439k 106k --:--:-- --:--:-- --:--:-- 607k
1000
1000
$ curl -X POST 'http://localhost:9308/search' --data '{
"index": "pile_test",
"query": {"bool": {"must": [{"bool": {"should": [{"match": {"content": {"query": "lurks torture", "operator": "or"}}}]}}]}}
,
"options": {
"ranker": "expr('\''1000 * top(lcs)'\'')"
}
}' | jq '.hits.hits[] | ._score'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1226 100 1002 100 224 691k 154k --:--:-- --:--:-- --:--:-- 1197k
2000
1000
Checklist:
To be completed by the assignee. Check off tasks that have been completed or are not applicable.
- [ ] Implementation completed
- [ ] Tests developed
- [ ] Documentation updated
- [ ] Documentation reviewed
- [ ] Changelog updated
- [x] OpenAPI YAML updated and issue created to rebuild clients
@scruel do you mean that there should be a way to specify ranker for each entry in the should separately?
@sanikolaev Yeap