Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to support using index fields as ranking factor #2095

Open
8 tasks
scruel opened this issue Apr 27, 2024 · 3 comments
Open
8 tasks

Ability to support using index fields as ranking factor #2095

scruel opened this issue Apr 27, 2024 · 3 comments
Labels
waiting Waiting for the original poster (in most cases) or something else

Comments

@scruel
Copy link

scruel commented Apr 27, 2024

Proposal:

This can give users more freedom to change the rankings result, otherwise, we may have to do the re-ranking by multiple query results with other programming languages.

Checklist:

To be completed by the assignee. Check off tasks that have been completed or are not applicable.

  • Task estimated
  • Specification created, reviewed and approved
  • Implementation completed
  • Tests developed
  • Documentation updated
  • Documentation proofread
  • Changelog updated
  • OpenAPI YAML updated and issue created to rebuild clients
@sanikolaev
Copy link
Collaborator

currently, I have to do two queries to achieve this, one for less than, one for gather than

Pls provide an example. I don't quite understand what you mean.

@sanikolaev sanikolaev added the waiting Waiting for the original poster (in most cases) or something else label Apr 30, 2024
@scruel
Copy link
Author

scruel commented May 4, 2024

Sorry, what I really need first is let manticoresearch support custom ranking by field values, consider this haven't yet been supported, then this issue is unnecessary, I've changed description.
BTW, if you can implment this feature, then abs function is useful as follows:

SELECT ... OPTION ranker=<score>-abs(<id>-10)+sph04;

<score> and id are not built-in ranking factors, they are index fields, which can give users more freedom to change rankings, the above will add score and 'whether <id> is close to 10' in to ranking consideration.

@scruel scruel changed the title Add abs to ranking factor aggregation functions Ability to support using index fields as ranking factor May 4, 2024
@sanikolaev
Copy link
Collaborator

need first is let manticoresearch support custom ranking by field values, consider this haven't yet been supported

It is supported to some extent, e.g.:

➜  ~ mysql -P9306 -h0 -e "drop table if exists t; create table t(f text, a int); insert into t(f, a) values('a', 1),('a a', 5); select *, weight() from t where match('a') option ranker=expr('a*2+5');"
+---------------------+------+------+----------+
| id                  | f    | a    | weight() |
+---------------------+------+------+----------+
| 1515860105357164700 | a a  |    5 |       15 |
| 1515860105357164699 | a    |    1 |        7 |
+---------------------+------+------+----------+

Please experiment with it and elaborate more on the task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Waiting for the original poster (in most cases) or something else
Projects
None yet
Development

No branches or pull requests

2 participants