Skip to content

Commit 7727999

Browse files
committed
Improve docstrings
1 parent 1a843d2 commit 7727999

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

  • weaviate/collections/classes

weaviate/collections/classes/grpc.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,16 @@ def numeric_decay(
430430
weight: Optional[float] = None,
431431
depth: Optional[int] = None,
432432
) -> _Boost:
433-
"""Apply numeric distance-based decay scoring from an origin value.
433+
"""Score decays with distance from a numeric origin — closer to the origin ranks higher.
434+
435+
Use this when "closer to X is better" (e.g., prefer prices near $50, houses near 2000 sqft).
436+
Requires you to define an origin and scale. For simple "higher is better" boosting without
437+
an origin, use `Boost.property()` instead.
434438
435439
Args:
436440
property: The numeric property name to compute distance from.
437-
origin: The origin point (numeric value).
438-
scale: Distance from origin where score equals decay.
441+
origin: The target value — documents closest to this score highest.
442+
scale: Distance from origin where score equals the decay value.
439443
offset: Documents within this distance from origin get full score (default 0).
440444
curve: Decay curve type: `Boost.Curve.EXPONENTIAL` (default), `Boost.Curve.GAUSSIAN`, or `Boost.Curve.LINEAR`.
441445
decay: Score at scale distance from origin (default 0.5).
@@ -467,11 +471,18 @@ def property( # noqa: A003
467471
weight: Optional[float] = None,
468472
depth: Optional[int] = None,
469473
) -> _Boost:
470-
"""Rank by a numeric property's value directly.
474+
"""Boost by a numeric property's raw value — higher values rank higher.
475+
476+
Use this for simple proportional boosting (e.g., popularity count, review score)
477+
when you don't need to define an origin or scale. For distance-based decay from a
478+
specific value, use `Boost.numeric_decay()` instead.
479+
480+
Currently only supports numeric (int/float) properties.
471481
472482
Args:
473-
name: The property name to use as a ranking signal.
483+
name: The numeric property name to use as a ranking signal.
474484
modifier: Score modifier: `Boost.Modifier.NONE` (default), `Boost.Modifier.LOG1P`, or `Boost.Modifier.SQRT`.
485+
Use LOG1P or SQRT to dampen the effect of large value ranges.
475486
weight: Blending weight [0,1] controlling how much the rank affects final scores.
476487
depth: Number of results to rescore (default 100, max 10000).
477488
"""

0 commit comments

Comments
 (0)