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

Order by best match when searching #433

Open
gehal4 opened this issue Jul 25, 2023 · 5 comments
Open

Order by best match when searching #433

gehal4 opened this issue Jul 25, 2023 · 5 comments

Comments

@gehal4
Copy link

gehal4 commented Jul 25, 2023

The search option is really great, however would be nice to have a option to filter by best match.
One option would offer the possibility to enable this feature like :

class Constants:
     # ....
     enable_search_weight: bool = False

In this case, when searching, it will apply an order on the weight of the search: one example for the weight is to sort by the length of the field(s) searched : https://stackoverflow.com/questions/15471718/how-to-sort-results-by-string-length-on-mongodb

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jan 12, 2024
@foarsitter
Copy link

It is easy to override the Filter.sort method and apply your custom sorting. I'm not familiar with mongodb but this looks promising: https://www.mongodb.com/docs/manual/core/indexes/index-types/index-text/control-text-search-results/

Don't forget to provide a PR when your implementation is ready!

@github-actions github-actions bot removed the Stale label Jan 13, 2024
Copy link

github-actions bot commented Apr 9, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Apr 9, 2024
@arthurio arthurio removed the Stale label Apr 9, 2024
Copy link

github-actions bot commented Oct 4, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Oct 4, 2024
@arthurio arthurio removed the Stale label Oct 4, 2024
Copy link

github-actions bot commented Dec 4, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Dec 4, 2024
@arthurio arthurio removed the Stale label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants