1. Matt Chaput
  2. whoosh
  3. Issues
Issue #289 resolved

<type 'exceptions.ValueError'> Asked for page X of 0

Bruno Rocha
created an issue

When googlebot crawl my search page it is testing greater paginations, so I end with a lot of tickets like this:

<type 'exceptions.ValueError'> Asked for page 2 of 0

Function argument list (self=<whoosh.searching.ResultsPage object>, results=<Top 0 Results for Or([And([Term('title', u'cate...iption', u'massas')])]) runtime=0.00338196754456>, pagenum=2, pagelen=18)

Code listing raise ValueError("pagenum must be >= 1")

    self.pagecount = int(ceil(self.total / pagelen))
    if pagenum > 1 and pagenum > self.pagecount:
        raise ValueError("Asked for page %s of %s"
                         % (pagenum, self.pagecount))


    self.pagenum = pagenum

    offset = (pagenum - 1) * pagelen

Variables pagenum 2 self <whoosh.searching.ResultsPage object> self.pagecount 0

It is not better to fallback to the last valid page? is it possible?

Comments (1)

  1. Log in to comment