You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I kept finding that repeated calls to Daft.search() were giving me incorrect results, so I did some digging.
_PAGE_0 = {"from": "0", "pagesize": str(_PAGE_SZ)} is a dictionary used when creating a new Daft instance to start pagination from 0.
However, when this is assigned:
self._paging = self._PAGE_0
The reference to the constant gets passed, not a copy. Later on, when we edit self._paging to say we should paginate from the 50th result, we also modify the constant.
Creating a new instance of Daft will result in beginning with the constant in the state the other instance left it in. Calling search() with the same instance of Daft has similar issues since this value is never returned to 0 as far as I can tell.
I have a dumb workaround to this, which is that I make a new instance and manually fix the constant _PAGE_0 each time before instantiation, but this is a dumb workaround.
I kept finding that repeated calls to Daft.search() were giving me incorrect results, so I did some digging.
_PAGE_0 = {"from": "0", "pagesize": str(_PAGE_SZ)}
is a dictionary used when creating a new Daft instance to start pagination from 0.However, when this is assigned:
self._paging = self._PAGE_0
The reference to the constant gets passed, not a copy. Later on, when we edit
self._paging
to say we should paginate from the 50th result, we also modify the constant.Creating a new instance of Daft will result in beginning with the constant in the state the other instance left it in. Calling search() with the same instance of Daft has similar issues since this value is never returned to 0 as far as I can tell.
I have a dumb workaround to this, which is that I make a new instance and manually fix the constant _PAGE_0 each time before instantiation, but this is a dumb workaround.
The text was updated successfully, but these errors were encountered: