diff --git a/tests/xapian_tests/tests/xapian_backend.py b/tests/xapian_tests/tests/xapian_backend.py index 86f9af0..ceb3200 100644 --- a/tests/xapian_tests/tests/xapian_backend.py +++ b/tests/xapian_tests/tests/xapian_backend.py @@ -130,6 +130,7 @@ class XapianSearchBackendTestCase(TestCase): {'flag': u'f', 'name': u'david2', 'text': u'indexed!\n2', 'sites': u"['2', '4', '6']", 'pub_date': u'20090223000000', 'value': u'000000000010', 'id': u'tests.xapianmockmodel.2', 'slug': u'http://example.com/2', 'popularity': '\xb4p', 'django_id': u'2', 'django_ct': u'tests.xapianmockmodel'}, {'flag': u't', 'name': u'david3', 'text': u'indexed!\n3', 'sites': u"['3', '6', '9']", 'pub_date': u'20090222000000', 'value': u'000000000015', 'id': u'tests.xapianmockmodel.3', 'slug': u'http://example.com/3', 'popularity': '\xcb\x98', 'django_id': u'3', 'django_ct': u'tests.xapianmockmodel'} ]) + import pdb; pdb.set_trace() def test_duplicate_update(self): self.sb.update(self.msi, self.sample_objs) diff --git a/tests/xapian_tests/tests/xapian_query.py b/tests/xapian_tests/tests/xapian_query.py index 7ceed88..bcc02dc 100644 --- a/tests/xapian_tests/tests/xapian_query.py +++ b/tests/xapian_tests/tests/xapian_query.py @@ -47,6 +47,10 @@ class XapianSearchQueryTestCase(TestCase): self.sq.add_filter(SQ(content=True)) self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query(true)') + def test_build_query_date(self): + self.sq.add_filter(SQ(content=datetime.date(2009, 5, 8))) + self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query(20090508000000)') + def test_build_query_datetime(self): self.sq.add_filter(SQ(content=datetime.datetime(2009, 5, 8, 11, 28))) self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query(20090508112800)') diff --git a/xapian_backend.py b/xapian_backend.py index 3c7c5b3..63c9aa7 100755 --- a/xapian_backend.py +++ b/xapian_backend.py @@ -734,10 +734,10 @@ class SearchQuery(BaseSearchQuery): expression, term = child field, filter_type = search_node.split_expression(expression) - if not isinstance(term, (list, tuple)): - term = _marshal_term(term) - else: + if isinstance(term, (list, tuple)): term = [_marshal_term(t) for t in term] + else: + term = _marshal_term(term) if field == 'content': query_list.append(self._content_field(term, is_not)) @@ -928,11 +928,11 @@ def _marshal_term(term): term = _marshal_datetime(term) elif isinstance(term, datetime.date): term = _marshal_date(term) - elif isinstance(term, bool): - if term: - term = u'true' - else: - term = u'false' + # elif isinstance(term, bool): + # if term: + # term = u'true' + # else: + # term = u'false' else: term = force_unicode(term).lower() return term