mirror of
https://github.com/Hopiu/xapian-haystack.git
synced 2026-04-21 15:14:50 +00:00
Passing three tests. Empty query, single content value, multi-content values
This commit is contained in:
parent
529edc24b4
commit
35f51e97bc
2 changed files with 10 additions and 6 deletions
|
|
@ -56,11 +56,11 @@ class XapianSearchQueryTestCase(TestCase):
|
|||
self.sq.add_filter(SQ(content='hello'))
|
||||
self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query(hello)')
|
||||
|
||||
# def test_build_query_multiple_words_and(self):
|
||||
# self.sq.add_filter(SQ(content='hello'))
|
||||
# self.sq.add_filter(SQ(content='world'))
|
||||
# self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query((hello AND world))')
|
||||
#
|
||||
def test_build_query_multiple_words_and(self):
|
||||
self.sq.add_filter(SQ(content='hello'))
|
||||
self.sq.add_filter(SQ(content='world'))
|
||||
self.assertEqual(self.sq.build_query().get_description(), 'Xapian::Query((hello AND world))')
|
||||
|
||||
# def test_build_query_multiple_words_not(self):
|
||||
# self.sq.add_filter(~SQ(content='hello'))
|
||||
# self.sq.add_filter(~SQ(content='world'))
|
||||
|
|
|
|||
|
|
@ -937,9 +937,13 @@ class SearchQuery(BaseSearchQuery):
|
|||
if not self.query_filter:
|
||||
query = xapian.Query('')
|
||||
else:
|
||||
query_list = []
|
||||
|
||||
for child in self.query_filter.children:
|
||||
expression, value = child
|
||||
query = xapian.Query(value)
|
||||
query_list.append(value)
|
||||
|
||||
query = xapian.Query(xapian.Query.OP_AND, query_list)
|
||||
|
||||
return query
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue