Allow the use of percent string in Bool.__and__ method (#780)

Signed-off-by: Godefroy Amaury de Malefète <[email protected]>
This commit is contained in:
Godefroy Amaury de Malefète
2024-07-25 13:46:50 -04:00
committed by GitHub
parent a029343fb5
commit a68e8b7daf
3 changed files with 61 additions and 3 deletions
+4 -2
View File
@@ -219,10 +219,12 @@ class Bool(Query):
del q._params["minimum_should_match"]
for qx in (self, other):
# TODO: percentages will fail here
min_should_match = qx._min_should_match
# all subqueries are required
if len(qx.should) <= min_should_match:
if (
isinstance(min_should_match, int)
and len(qx.should) <= min_should_match
):
q.must.extend(qx.should)
# not all of them are required, use it and remember min_should_match
elif not q.should: