django-haystack / django-haystack/django-haystack
Distinct filter on SearchQuerySet
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.7k
- Forks
- 1.3k
- Avg merge
- 3h 18m
- Merged PRs (30d)
- 3
Description
Use-case:
I have a series of organizations and one organization can have multiple offices.
My query is so that the current user has a location and I show the offices ordered by distance.
What I would like is to only show the nearest office, not all. This would be easy in normal django query with distinct, but is not implemented in haystack?
I can not apply distinct on my searchindex, because the users have different locations.
Also, if I use the organizations and calculate distance on the fly, I lose the dwithin filtering possibilities with haystack.
Any suggestions appreciated!
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 with SearchQuerySet and its existing dwithin filtering behavior, then compare the requested distinct semantics with normal Django queries. Clarify whether the intended result is the nearest office per organization and which search backends must support it before defining tests for the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100