objectbox / objectbox/objectbox-dart
Adding Maximal Marginal Relevance (MMR) for searching
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 1.2k
- Forks
- 162
- Avg merge
- 15m
- Merged PRs (30d)
- 1
Description
Is there an existing issue?
- I have searched existing issues
Use case
Imagine you search for “AI in healthcare” in a news app.
A normal nearestNeighborsF32 search might return the top 10 most relevant articles — but 8 of them may be about chatbots for hospitals, basically saying the same thing.
With Maximal Marginal Relevance (MMR), the system instead returns:
- An article about chatbots in hospitals
- One about AI in medical imaging
- One about drug discovery
- One about patient data analysis
This way, you still get relevant results for your query, but also diverse perspectives, rather than numerous near-duplicates.
Proposed solution
- Support Maximal Marginal Relevance (MMR): a method for retrieving documents that balances similarity to the query with diversity among the selected items. It is calculated as follows:
- Alternative solution: expose an API for calculating the similarity between two vector embeddings, allowing developers to implement MMR within their own applications.
Additional context
- I’d be happy to contribute if you can point me to where I should start.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Dart API for nearestNeighborsF32 and reviewing how vector search results are exposed. Compare whether the project should provide MMR directly or expose embedding-similarity calculation for application code. Done means the chosen API is defined, documented, and covered by appropriate search behavior tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- databases, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100