You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I understand the documentation, a TimeLimitCollector can be used to simply wrap any other collector in order to add a time-out feature. It should not affect the results in any way.
However, in a code base I'm working on, adding a TimeLimitCollector breaks the filtering of an underlying FilterCollector
This happens on the current PyPI release (2.7.4) as well as the current master (5421f1a).
Minimal example to reproduce:
#!/usr/bin/env python3importosfromwhoosh.fieldsimportSchema, TEXT, IDfromwhoosh.filedb.filestoreimportFileStoragefromwhoosh.queryimportTermfromwhoosh.qparserimportQueryParserfromwhoosh.collectorsimportTimeLimitCollectorifnotos.path.exists("test_index"):
os.makedirs("test_index")
schema=Schema(id=ID(stored=True), text=TEXT(stored=True))
storage=FileStorage("test_index")
ix=storage.create_index(schema)
writer=ix.writer()
writer.add_document(text=u"test", id="1")
writer.commit()
query_parser=QueryParser("text", schema)
query=query_parser.parse("test")
id_term=Term("id", "0")
withix.searcher() assearcher:
collector=searcher.collector(limit=10, filter=id_term)
# Add this line and the assertion will fail# collector = TimeLimitCollector(collector, timelimit=5.0)searcher.search_with_collector(query, collector)
print(collector.results())
assert(len(collector.results()) ==0)
Did I misunderstand something or is this a bug?
The text was updated successfully, but these errors were encountered:
As far as I understand the documentation, a
TimeLimitCollector
can be used to simply wrap any other collector in order to add a time-out feature. It should not affect the results in any way.However, in a code base I'm working on, adding a
TimeLimitCollector
breaks the filtering of an underlyingFilterCollector
This happens on the current PyPI release (2.7.4) as well as the current master (5421f1a).
Minimal example to reproduce:
Did I misunderstand something or is this a bug?
The text was updated successfully, but these errors were encountered: