Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Reverse slices result in negative size #1358

Closed
bk-equityzen opened this issue May 5, 2020 · 6 comments · Fixed by #1360
Closed

Reverse slices result in negative size #1358

bk-equityzen opened this issue May 5, 2020 · 6 comments · Fixed by #1360
Labels
Category: Bug Something isn't right

Comments

@bk-equityzen
Copy link
Contributor

bk-equityzen commented May 5, 2020

search[20:0]

results in -20 as the size sent to ElasticSearch. This can possibly cause an error: RequestError(400, 'search_phase_execution_exception', 'numHits must be > 0; please use TotalHitCountCollector if you just need the total hit count')

Proposed Solution:
The slice function should result in a minimum size of 0

s._extra['size'] = n.stop - (n.start or 0) if n.stop is not None else 10
s._extra['size'] = max(s._extra['size'], 0)
@sethmlarson
Copy link
Contributor

Nice catch! Would you be willing to provide a fix and test case for this issue?

@sethmlarson sethmlarson added the Category: Bug Something isn't right label May 5, 2020
@bk-equityzen
Copy link
Contributor Author

Nice catch! Would you be willing to provide a fix and test case for this issue?

Done! #1360

@sethmlarson
Copy link
Contributor

@shanon-equityzen I can try to get a patch release out tomorrow.

@bk-equityzen
Copy link
Contributor Author

@sethmlarson any update on the next release?

@sethmlarson
Copy link
Contributor

@bk-equityzen Released v7.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug Something isn't right
Projects
None yet
3 participants
@sethmlarson @bk-equityzen and others