Issue #212 resolved

two dates ranges filtering is crashing

Roberto Faga
created an issue

I'm using haystack and crashing on some date filtering problem in Whoosh. This happens when I try to fitler by a raw query two dates intervals with only one arg passed, for instance:

Considering operation_start and operation_end as a date fields, these lines works nicely: {{{

!python

qp.parse("operation_start:[2008 to]") qp.parse("operation_start:[2008 to 2011] AND operation_end:[2011 to 2012]") }}} But if I try without one year of ranges it crashes: {{{

!python

qp.parse("operation_start:[2008 to] AND operation_end:[2011 to 2011]")

ValueError Traceback (most recent call last) ... /usr/local/lib/python2.7/dist-packages/Whoosh-2.3.0-py2.7.egg/whoosh/fields.pyc in _parse_datestring(self, qstring) 610 year = month = day = hour = minute = second = microsecond = None 611 if len(qstring) >= 4: --> 612 year = int(qstring[:4]) 613 if len(qstring) >= 6: 614 month = int(qstring[4:6])

ValueError: invalid literal for int() with base 10: ']AND'

}}} So the problem seems to be at separating a "to" field, as it's considering that ]AND is part of a date end. While I can handle it putting intervals, I think this could be some bug.

Comments (1)

  1. Log in to comment