django-haystack / django-haystack/django-haystack
Can django-haystack filter MultiValueFields like in given example?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.7k
- Forks
- 1.3k
- Avg merge
- 3h 18m
- Merged PRs (30d)
- 3
Description
Can django-haystack filter MultiValueFields like in following example?:
persons = indexes.MultiValueField()
Example data:
persons = [{"name": "John", "occupation": "artist"}, {"name": "Paul", "occupation": "teacher"}]
import haystack
haystack.query.SearchQuerySet().filter(persons__occupation="teacher")
I guess no? So instead I should create a field for each occupation like so?:
teachers = indexes.MultiValueField()
Example data:
teachers = ["Paul", "Henry"]
So that I basically avoid filtering. Now I could just do, which gets all indexes where teachers is not empty:
haystack.query.SearchQuerySet().filter(teachers=Raw("*"))
Or do you recommend to use a Raw elasticsearch query with my first example too?
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 MultiValueField and SearchQuerySet.filter, then inspect how the Elasticsearch Raw query path is exposed. Determine whether nested occupation filtering is supported; done means documenting the supported query or a clear limitation and recommended field representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, python
- Domain
- search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100