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

feat: MetaFieldRanker update #6742

Merged
merged 15 commits into from
Jan 16, 2024
Merged

feat: MetaFieldRanker update #6742

merged 15 commits into from
Jan 16, 2024

Conversation

sjrl
Copy link
Contributor

@sjrl sjrl commented Jan 15, 2024

Related Issues

  • partially addresses the RecentnessRanker in issue Port selected 1.x components to 2.x #6673. Only partially because this does not introduce the infer_type boolean discussed with @masci that would toggle whether we try to auto detect the type of the specified meta_field if all values of that meta field value are strings. Instead in this PR we focused on robustness of the MetaFieldRanker to fail less often by handling more edge cases and writing appropriate warning messages for them.

Proposed Changes:

  • Makes the MetaFieldRanker more robust. Specifically to prevent the ranker from throwing an error if one or more of the documents doesn't contain the specific meta data field. Now those documents will be ignored for ranking purposes and placed at the end of the ranked list so we don't completely throw them away.
  • Adding a sort_order that can have values of descending or ascending. This allows the user to decide which direction to sort the meta values. Before we had descending hard-coded. ascending could be useful, for example, ranking golfers were the the lowest score is best.
  • Refactoring
    • Used logger.warning where appropriate
    • consolidated duplicate code
    • added more params to the run time so users have more flexibility

How did you test it?

  • updated and added unit tests
  • removed integration markings since all tests run very fast

Notes for the reviewer

Checklist

@sjrl sjrl requested a review from a team as a code owner January 15, 2024 12:15
@sjrl sjrl requested review from anakin87 and removed request for a team January 15, 2024 12:15
@sjrl sjrl changed the title feat: Metafield ranker update feat: MetaFieldRanker update Jan 15, 2024
@github-actions github-actions bot added topic:tests 2.x Related to Haystack v2.0 type:documentation Improvements on the docs labels Jan 15, 2024
@sjrl sjrl requested a review from a team as a code owner January 15, 2024 12:17
@sjrl sjrl requested review from dfokina and removed request for a team January 15, 2024 12:17
@sjrl sjrl force-pushed the metafield-ranker-update branch from d160239 to 7fcef14 Compare January 15, 2024 12:18
@coveralls
Copy link
Collaborator

coveralls commented Jan 15, 2024

Pull Request Test Coverage Report for Build 7534119821

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.7%) to 87.891%

Totals Coverage Status
Change from base Build 7529773910: 0.7%
Covered Lines: 4355
Relevant Lines: 4955

💛 - Coveralls

@sjrl sjrl force-pushed the metafield-ranker-update branch from 10d415a to 0488e59 Compare January 15, 2024 14:09
Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good to me!

I left only a small comment to improve the expressiveness of the release note.

@sjrl sjrl merged commit 20f04f6 into main Jan 16, 2024
22 checks passed
@sjrl sjrl deleted the metafield-ranker-update branch January 16, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to Haystack v2.0 topic:tests type:documentation Improvements on the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants