From acd0631f93afab6125d09180bfe9e31e9f745b82 Mon Sep 17 00:00:00 2001 From: Rossi Lorenzo Date: Tue, 15 Feb 2022 18:34:47 +0100 Subject: [PATCH] Fix boost in date/date queries Fixed boost missing in ambiguous date queries Fices incorrect value in RangeNode.has_boost --- src/whoosh/fields.py | 2 +- src/whoosh/qparser/syntax.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/whoosh/fields.py b/src/whoosh/fields.py index ebe72315..9df7f464 100644 --- a/src/whoosh/fields.py +++ b/src/whoosh/fields.py @@ -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) diff --git a/src/whoosh/qparser/syntax.py b/src/whoosh/qparser/syntax.py index 8e0fb474..0c35ff91 100644 --- a/src/whoosh/qparser/syntax.py +++ b/src/whoosh/qparser/syntax.py @@ -450,6 +450,7 @@ class RangeNode(SyntaxNode): """ has_fieldname = True + has_boost = True def __init__(self, start, end, startexcl, endexcl): self.start = start