Skip to content
New issue

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

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

Already on GitHub? # to your account

Add possibility to replace queryset filter with custom function #138

Closed
simon-retsch opened this issue Jan 18, 2023 · 2 comments · Fixed by #139
Closed

Add possibility to replace queryset filter with custom function #138

simon-retsch opened this issue Jan 18, 2023 · 2 comments · Fixed by #139

Comments

@simon-retsch
Copy link
Contributor

Description

We ran into the problem that a search term (on a non-wagtail page model) was resulting in more than 100 results that could therefore not be fully displayed. The entry we wanted to find was not included in the 100 items and therefore the search (icontains-filter) was not prioritizing our expected result.

Suggestion

It would be great if one could implement a function like autocomplete_custom_queryset_filter in the model-to-search so that one can implement a different prioritization or improve the search in general as needed.

@simon-retsch
Copy link
Contributor Author

Since we would need this functionality I already modified the necessary code locally so I could quickly create a PR for it, if this feature is approved to be added.

simon-retsch added a commit to simon-retsch/wagtail-autocomplete that referenced this issue Jan 18, 2023
Since it is not possible to improve the search currently a check was
implemented to look for a custom search function in the model to filter.
If one is found it is called and the result is validated to be a
queryset of the expected type.
@rinti
Copy link

rinti commented Jan 18, 2023

This would solve #120 too

simon-retsch added a commit to simon-retsch/wagtail-autocomplete that referenced this issue Jan 19, 2023
Since it is not possible to improve the search currently a check was
implemented to look for a custom search function in the model to filter.
If one is found it is called and the result is validated to be a
queryset of the expected type.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
2 participants