Skip to content

Commit

Permalink
Zipnum index: do fail if counting pages with filter params (#631)
Browse files Browse the repository at this point in the history
- do not apply any filters (param filter, from, to, closest)
  if counting pages (param showNumPages=true)
  • Loading branch information
sebastian-nagel committed Apr 27, 2021
1 parent cdb17c4 commit 73d6735
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pywb/warcserver/index/aggregator.py
Expand Up @@ -37,7 +37,9 @@ def __call__(self, params):

cdx_iter, errs = self.load_index(query.params)

cdx_iter = process_cdx(cdx_iter, query)
if not query.page_count:
cdx_iter = process_cdx(cdx_iter, query)

return cdx_iter, dict(errs)

def load_child_source(self, name, source, params):
Expand Down
8 changes: 8 additions & 0 deletions pywb/warcserver/index/test/test_zipnum.py
Expand Up @@ -228,6 +228,14 @@ def test_blocks_zero_pages():
res = zip_ops_test_data(url='http://aaa.zz/', matchType='domain', showNumPages=True)
assert(res == {"blocks": 0, "pages": 0, "pageSize": 10})

def test_blocks_ignore_filter_params():
res = zip_ops_test_data(url='*.iana.org', pageSize='4', showNumPages=True, filter='=status:200')
assert(res == {"blocks": 38, "pages": 10, "pageSize": 4})

def test_blocks_ignore_timestamp_params():
res = zip_ops_test_data(url='*.iana.org', pageSize='4', showNumPages=True, closest='20140126000000')
assert(res == {"blocks": 38, "pages": 10, "pageSize": 4})


# Errors

Expand Down

0 comments on commit 73d6735

Please sign in to comment.