drf-haystack icon indicating copy to clipboard operation
drf-haystack copied to clipboard

Add filters to nested property

Open isaacjoy opened this issue 6 years ago • 1 comments

Is it possible to add filters to nested SearchFields?

For example: the following SearchField:

class DocumentField(SearchField):
    field_type = 'nested'
    properties = {
        'letters_count': {'type': 'integer'},
    }

Is used in this index:

from .search_fields import DocumentField

class TutorialIndex(indexes.SearchIndex, indexes.Indexable):
    document = DocumentField(stored=True)

but when I search: /search/?document__letters_count__gte=1000 - I get no results when there are definitely documents within the index that have a letter count greater than 1000.

isaacjoy avatar Apr 17 '18 23:04 isaacjoy

Hey, I'm afraid that's not possible at the moment. I don't really see that I'll have time implementing this in the near future as I have very limited time working on this library these days. However I'm always willing to accept PRs with new functionality :)

rhblind avatar Jun 16 '18 18:06 rhblind