rhblind/drf-haystack

Using `__range` filter

Closed this issue · 3 comments

Hello

Thanks a lot for a great library - it's making API-ifying search easier.

I have a query using the __range filter on an integer field. I can't quite get it to work but it's doing "something".

/search/?release_year=1990,1995 show's me all releases in those two years using an OR, which is fine.

/search/?release_year__range=1990,1995 is translating to (release_year:(["1" TO "9"]) OR release_year:(["1" TO "9"])) with the second filter coming from the 1995 - I verified this by changing YYYY to YY. Which feels simiar to what was going on in #51.

Do I need to change how I'm forming the query string? Or is this not supported?

I wondered if I might need to special case this and write my own QueryBuilder, tweaking this function.

Thanks for any advice you can offer.

Regards
Ben.

Hi, thanks for the report.
Not quite sure what's going on here, but I'll try to have a look at it.
If you figure out a solution on your own, please feel free to submit a PR :)

There you go, v1.8.3 fresh in the cheese shop!

@rhblind amazing, thank you!