Skip to content

Commit

Permalink
Fix boost in date/date queries
Browse files Browse the repository at this point in the history
Fixed boost missing in ambiguous date queries
Fices incorrect value in RangeNode.has_boost
  • Loading branch information
SnowyCoder committed Feb 15, 2022
1 parent d9a3fa2 commit acd0631
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/whoosh/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ def parse_query(self, fieldname, qstring, boost=1.0):
if is_ambiguous(at):
startnum = datetime_to_long(at.floor())
endnum = datetime_to_long(at.ceil())
return query.NumericRange(fieldname, startnum, endnum)
return query.NumericRange(fieldname, startnum, endnum, boost=boost)
else:
return query.Term(fieldname, at, boost=boost)

Expand Down
1 change: 1 addition & 0 deletions src/whoosh/qparser/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ class RangeNode(SyntaxNode):
"""

has_fieldname = True
has_boost = True

def __init__(self, start, end, startexcl, endexcl):
self.start = start
Expand Down

0 comments on commit acd0631

Please sign in to comment.