Skip to content

Performance improvement for first - avoids unnecessary pagination. #219

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

Merged
merged 2 commits into from
Apr 25, 2022

Conversation

simonprickett
Copy link
Contributor

@simonprickett simonprickett commented Apr 25, 2022

first() was running the ft.search query to get the first item, then also paginating the whole dataset unnecessarily. This PR addresses that by setting exhaust_results=False whenever first calls query.execute(). This stops the pagination. Closes #218 and adds a test for first() using HashModel.

@simonprickett simonprickett self-assigned this Apr 25, 2022
@simonprickett simonprickett added the bug Something isn't working label Apr 25, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 25, 2022

Codecov Report

Merging #219 (129ef95) into main (c0fa1be) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #219   +/-   ##
=======================================
  Coverage   77.25%   77.25%           
=======================================
  Files          12       12           
  Lines        1165     1165           
=======================================
  Hits          900      900           
  Misses        265      265           
Flag Coverage Δ
unit 77.25% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aredis_om/model/model.py 86.27% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c0fa1be...129ef95. Read the comment docs.

@simonprickett simonprickett marked this pull request as ready for review April 25, 2022 12:31
@simonprickett simonprickett merged commit 49a4a1e into main Apr 25, 2022
@simonprickett simonprickett deleted the fix-unnecessary-commands-for-first-search-#218 branch April 25, 2022 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Finding first match not working as expected?
2 participants