mirror of
https://github.com/Hopiu/xapian-haystack.git
synced 2026-05-16 02:53:13 +00:00
Fixed to allow boost on phrase as well as single terms
This commit is contained in:
parent
ef8ca2dfa7
commit
712958f0db
2 changed files with 2 additions and 2 deletions
|
|
@ -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'))
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue