manticoresearch icon indicating copy to clipboard operation
manticoresearch copied to clipboard

Ability to apply lcs to multiple-matches query via API

Open scruel opened this issue 1 year ago • 2 comments

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 avatar Jul 14 '24 11:07 scruel

@scruel do you mean that there should be a way to specify ranker for each entry in the should separately?

sanikolaev avatar Jul 16 '24 04:07 sanikolaev

@sanikolaev Yeap

scruel avatar Jul 16 '24 12:07 scruel