Use of TimeLimitCollector results in an AttributeError if timeout happens early in the query process.

Issue #382 new
Elliot Shank
created an issue

Query is being done like

def _perform_unpaged_search(searcher, query, results_limit, time_limit):
    collector = TimeLimitCollector(
        searcher.collector(limit = results_limit), time_limit

        searcher.search_with_collector(query, collector)
    except TimeLimit:
            r'Query took more than %f seconds. Will only return partial results.' \
                % time_limit

    return collector.results()

Later, I invoke has_exact_length() on the Results.

I've got a query that takes about a minute and a half to run fully. If I set time_limit to 10 seconds, everything works fine. However, if time_limit is 6 seconds, I get an AttributeError when invoking has_exact_length():

File "<path>/lib/python3.3/site-packages/Whoosh-2.6.0-py3.3.egg/whoosh/", line 1099, in has_exact_length
    return self.collector.computes_count()
File "<path>/lib/python3.3/site-packages/Whoosh-2.6.0-py3.3.egg/whoosh/", line 445, in computes_count
    return not self._use_block_quality()
File "<path>/lib/python3.3/site-packages/Whoosh-2.6.0-py3.3.egg/whoosh/", line 442, in _use_block_quality
    and self.matcher.supports_block_quality())
AttributeError: 'TopCollector' object has no attribute 'matcher'

Whoosh 2.6.0, Python 3.3.3.

Comments (2)

  1. Log in to comment