Skip to content

Commit 1a843d2

Browse files
committed
Review feedback
1 parent 393d487 commit 1a843d2

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

integration/test_collection_boost.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def test_boost_numeric_decay(collection_factory: CollectionFactory) -> None:
115115
origin=50.0,
116116
scale=20.0,
117117
curve=Boost.Curve.LINEAR,
118+
decay=0.5,
118119
weight=1.0,
119120
),
120121
return_metadata=MetadataQuery(distance=True),
@@ -135,6 +136,7 @@ def test_boost_time_decay(collection_factory: CollectionFactory) -> None:
135136
origin="2024-01-01T00:00:00Z",
136137
scale="365d",
137138
curve=Boost.Curve.EXPONENTIAL,
139+
decay=0.3,
138140
weight=1.0,
139141
),
140142
return_metadata=MetadataQuery(distance=True),

weaviate/collections/classes/grpc.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ def time_decay(
382382
scale: Union[str, timedelta],
383383
offset: Optional[Union[str, timedelta]] = None,
384384
curve: Optional[Union[_BoostCurve, str]] = None,
385-
decay_value: Optional[float] = None,
385+
decay: Optional[float] = None,
386386
weight: Optional[float] = None,
387387
depth: Optional[int] = None,
388388
) -> _Boost:
@@ -392,12 +392,12 @@ def time_decay(
392392
property: The date property name to compute distance from.
393393
origin: The origin point. Use "now" for current time or a datetime for a specific time.
394394
Defaults to "now".
395-
scale: Distance from origin where score equals decay_value. Use timedelta
395+
scale: Distance from origin where score equals decay. Use timedelta
396396
(e.g. timedelta(days=7)) or a string shorthand like "7d", "24h".
397397
offset: Documents within this distance from origin get full score (default "0").
398398
Accepts the same types as scale.
399399
curve: Decay curve type: `Boost.Curve.EXPONENTIAL` (default), `Boost.Curve.GAUSSIAN`, or `Boost.Curve.LINEAR`.
400-
decay_value: Score at scale distance from origin (default 0.5).
400+
decay: Score at scale distance from origin (default 0.5).
401401
weight: Blending weight [0,1] controlling how much the rank affects final scores.
402402
depth: Number of results to rescore (default 100, max 10000).
403403
"""
@@ -410,7 +410,7 @@ def time_decay(
410410
scale=_decay_value_to_str(scale),
411411
offset=_decay_value_to_str(offset) if offset is not None else None,
412412
curve=curve.value if isinstance(curve, _BoostCurve) else curve,
413-
decay_value=decay_value,
413+
decay_value=decay,
414414
)
415415
)
416416
],
@@ -426,7 +426,7 @@ def numeric_decay(
426426
scale: float,
427427
offset: Optional[float] = None,
428428
curve: Optional[Union[_BoostCurve, str]] = None,
429-
decay_value: Optional[float] = None,
429+
decay: Optional[float] = None,
430430
weight: Optional[float] = None,
431431
depth: Optional[int] = None,
432432
) -> _Boost:
@@ -435,10 +435,10 @@ def numeric_decay(
435435
Args:
436436
property: The numeric property name to compute distance from.
437437
origin: The origin point (numeric value).
438-
scale: Distance from origin where score equals decay_value.
438+
scale: Distance from origin where score equals decay.
439439
offset: Documents within this distance from origin get full score (default 0).
440440
curve: Decay curve type: `Boost.Curve.EXPONENTIAL` (default), `Boost.Curve.GAUSSIAN`, or `Boost.Curve.LINEAR`.
441-
decay_value: Score at scale distance from origin (default 0.5).
441+
decay: Score at scale distance from origin (default 0.5).
442442
weight: Blending weight [0,1] controlling how much the rank affects final scores.
443443
depth: Number of results to rescore (default 100, max 10000).
444444
"""
@@ -451,7 +451,7 @@ def numeric_decay(
451451
scale=float(scale),
452452
offset=float(offset) if offset is not None else None,
453453
curve=curve.value if isinstance(curve, _BoostCurve) else curve,
454-
decay_value=decay_value,
454+
decay_value=decay,
455455
)
456456
)
457457
],
@@ -510,13 +510,7 @@ def blend(
510510
for r in ranks:
511511
for cond in r.conditions:
512512
if cond.weight is None and r.weight is not None:
513-
cond = _BoostCondition(
514-
filter=cond.filter,
515-
time_decay=cond.time_decay,
516-
numeric_decay=cond.numeric_decay,
517-
property_value=cond.property_value,
518-
weight=r.weight,
519-
)
513+
cond.weight = r.weight
520514
conditions.append(cond)
521515
return _Boost(conditions=conditions, weight=weight, depth=depth)
522516

0 commit comments

Comments
 (0)