Skip to content

Commit 171cd30

Browse files
author
Jim Scarborough
committed
cleanup suggested by acdha
1 parent e7e4b66 commit 171cd30

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: pysolr.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,10 @@ def __init__(self, decoded, next_page_query=None):
299299
and next_page_query or None
300300

301301
def __len__(self):
302-
return self._next_page_query and self.hits or len(self.docs)
302+
if self._next_page_query:
303+
return self.hits
304+
else:
305+
return len(self.docs)
303306

304307
def __iter__(self):
305308
result = self
@@ -830,11 +833,11 @@ def search(self, q, search_handler=None, **kwargs):
830833
(decoded.get("response", {}) or {}).get("numFound", 0),
831834
)
832835

833-
if "cursorMark" in params and params["cursorMark"] != \
834-
decoded.get('nextCursorMark', params["cursorMark"]):
836+
cursorMark = params.get("cursorMark", None)
837+
if cursorMark != decoded.get("nextCursorMark", cursorMark):
835838
def next_page_query():
836-
nextParams = dict(params)
837-
nextParams["cursorMark"] = decoded['nextCursorMark']
839+
nextParams = params.copy()
840+
nextParams["cursorMark"] = decoded["nextCursorMark"]
838841
return self.search(search_handler=search_handler, **nextParams)
839842
return self.results_cls(decoded, next_page_query)
840843
else:

0 commit comments

Comments
 (0)