Add AttributeRank and WordPosition to ranking criteria by Shabhareash · Pull Request #6190 · meilisearch/meilisearch · GitHub
Skip to content

Add AttributeRank and WordPosition to ranking criteria#6190

Open
Shabhareash wants to merge 5 commits intomeilisearch:mainfrom
Shabhareash:main
Open

Add AttributeRank and WordPosition to ranking criteria#6190
Shabhareash wants to merge 5 commits intomeilisearch:mainfrom
Shabhareash:main

Conversation

@Shabhareash
Copy link
Copy Markdown

@Shabhareash Shabhareash commented Mar 1, 2026

Related issue

Fixes #6185

imp : Could a maintainer please add the no db change label? This PR contains no database changes. (my first PR i forgot sorry)

What does this PR do?

Fixes a bug where placing attributeRank or wordPosition before the words
ranking rule would prevent the Words rule from being auto-injected, causing
only documents matching ALL query terms to be returned instead of also returning
partial matches.

Added AttributeRank and WordPosition to the match arm in
get_ranking_rules_for_query_graph_search that auto-inserts the Words ranking rule.

  • This PR does not use generative AI tooling
  • This PR uses generative AI tooling and respect the related policies
    • list of used tools and what they were used for

Requirements

⚠️ Ensure the following requirements before merging ⚠️

  • Automated tests have been added.
  • If some tests cannot be automated, manual rigorous tests should be applied.
  • ⚠️ If there is any change in the DB:
    • Test that any impacted DB still works as expected after using --experimental-dumpless-upgrade on a DB created with the last released Meilisearch
    • Test that during the upgrade, search is still available (artificially make the upgrade longer if needed)
    • Set the db change label.
  • If necessary, the feature have been tested in the Cloud production environment (with prototypes) and the Cloud UI is ready.
  • If necessary, the documentation related to the implemented feature in the PR is ready.
  • If necessary, the integrations related to the implemented feature in the PR are ready.

@ManyTheFish ManyTheFish added the no db change The database didn't change label Mar 11, 2026
@ManyTheFish
Copy link
Copy Markdown
Member

@Shabhareash
Copy link
Copy Markdown
Author

Shabhareash commented Mar 11, 2026 via email

@Kerollmops
Copy link
Copy Markdown
Member

Hey @Shabhareash 👋 Would you mind mixing the last little issues in the CI, please?

@Shabhareash
Copy link
Copy Markdown
Author

Shabhareash commented Mar 12, 2026 via email

Shabhareash and others added 5 commits March 13, 2026 01:25
Removed unused criteria 'AttributeRank' and 'WordPosition' from the match statement.
When AttributeRank or WordPosition was placed before Words in the ranking
rules, the Words rule was never auto-inserted. This prevented
TermsMatchingStrategy from removing query words to find more results,
causing fewer hits to be returned.

Adds regression tests to verify the fix.
@Shabhareash
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no db change The database didn't change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing ranking rules order removes hits

3 participants