Changeset View
Changeset View
Standalone View
Standalone View
swh/search/elasticsearch.py
Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | def origin_search( | ||||
body['search_after'] = \ | body['search_after'] = \ | ||||
[page_token_content[b'score'], | [page_token_content[b'score'], | ||||
page_token_content[b'sha1'].decode('ascii')] | page_token_content[b'sha1'].decode('ascii')] | ||||
res = self._backend.search( | res = self._backend.search( | ||||
index='origin', | index='origin', | ||||
body=body, | body=body, | ||||
size=count, | size=count, | ||||
# XXX: make that configurable (either method parameter | |||||
# or application config...) | |||||
request_timeout=20, | |||||
) | ) | ||||
hits = res['hits']['hits'] | hits = res['hits']['hits'] | ||||
if len(hits) == count: | if len(hits) == count: | ||||
last_hit = hits[-1] | last_hit = hits[-1] | ||||
next_page_token_content = { | next_page_token_content = { | ||||
b'score': last_hit['_score'], | b'score': last_hit['_score'], | ||||
Show All 17 Lines |