Fixed to allow boost on phrase as well as single terms

This commit is contained in:
David Sauve 2011-05-11 14:13:34 -07:00
parent ef8ca2dfa7
commit 712958f0db
2 changed files with 2 additions and 2 deletions

View file

@ -111,7 +111,7 @@ class XapianSearchQueryTestCase(TestCase):
def test_build_query_boost(self):
self.sq.add_filter(SQ(content='hello'))
self.sq.add_boost('world', 5)
self.assertEqual(str(self.sq.build_query()), u'Xapian::Query(((Zhello OR hello) AND_MAYBE 5 * world))')
self.assertEqual(str(self.sq.build_query()), u'Xapian::Query(((Zhello OR hello) AND_MAYBE 5 * (Zworld OR world)))')
def test_build_query_in_filter_single_words(self):
self.sq.add_filter(SQ(content='why'))

View file

@ -942,7 +942,7 @@ class SearchQuery(BaseSearchQuery):
if self.boost:
subqueries = [
xapian.Query(
xapian.Query.OP_SCALE_WEIGHT, xapian.Query(term), value
xapian.Query.OP_SCALE_WEIGHT, self._content_field(term, False), value
) for term, value in self.boost.iteritems()
]
query = xapian.Query(