diff --git a/docs/source/searching.rst b/docs/source/searching.rst index ab4f2a90..97c8e5d1 100644 --- a/docs/source/searching.rst +++ b/docs/source/searching.rst @@ -300,8 +300,8 @@ To limit the amount of time a search can take:: with myindex.searcher() as s: # Get a collector object c = s.collector(limit=None, sortedby="title_exact") - # Wrap it in a TimeLimitedCollector and set the time limit to 10 seconds - tlc = TimeLimitedCollector(c, timelimit=10.0) + # Wrap it in a TimeLimitCollector and set the time limit to 10 seconds + tlc = TimeLimitCollector(c, timelimit=10.0) # Try searching try: diff --git a/src/whoosh/collectors.py b/src/whoosh/collectors.py index 5b7e9c1a..507d56b4 100644 --- a/src/whoosh/collectors.py +++ b/src/whoosh/collectors.py @@ -1008,7 +1008,7 @@ class TimeLimitCollector(WrappingCollector): does not complete within a certain number of seconds:: uc = collectors.UnlimitedCollector() - tlc = TimeLimitedCollector(uc, timelimit=5.8) + tlc = TimeLimitCollector(uc, timelimit=5.8) try: mysearcher.search_with_collector(myquery, tlc) except collectors.TimeLimit: diff --git a/src/whoosh/searching.py b/src/whoosh/searching.py index 64d74f5f..9f8288c2 100644 --- a/src/whoosh/searching.py +++ b/src/whoosh/searching.py @@ -51,9 +51,9 @@ class NoTermsException(Exception): class TimeLimit(Exception): - """Raised by :class:`TimeLimitedCollector` if the time limit is reached + """Raised by :class:`TimeLimitCollector` if the time limit is reached before the search finishes. If you have a reference to the collector, you - can get partial results by calling :meth:`TimeLimitedCollector.results`. + can get partial results by calling :meth:`TimeLimitCollector.results`. """ pass @@ -688,9 +688,9 @@ def collector(self, limit=10, sortedby=None, reverse=False, groupedby=None, # Create a TopCollector c = mysearcher.collector(limit=10) - # Wrap it with a TimeLimitedCollector with a time limit of + # Wrap it with a TimeLimitCollector with a time limit of # 10.5 seconds - from whoosh.collectors import TimeLimitedCollector + from whoosh.collectors import TimeLimitCollector c = TimeLimitCollector(c, 10.5) # Search using the custom collector