ZeroDivisionError in search

Issue #490 new
Michal Čihař
created an issue
ZeroDivisionError: division by zero
  File "whoosh/", line 786, in search
    self.search_with_collector(q, c)
  File "whoosh/", line 819, in search_with_collector
  File "whoosh/", line 144, in run
  File "whoosh/", line 743, in collect_matches
  File "whoosh/", line 369, in collect
    score = self.matcher.score()
  File "whoosh/matching/", line 571, in score
    return self._sqr(score, matching)
  File "whoosh/matching/", line 554, in _sqr
    ((termcount - 1) / termcount))

The problematic variable being termcount = 0

Comments (2)

  1. Michal Čihař reporter

    The root cause being that Term.matcher() returned NullMatcher for some reason. Unfortunately I can't reproduce the issue right now to know why it did so. Still the matcher should deal with this situation gracefully.

  2. Log in to comment