Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions _includes/code/howto/search.boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
query="transformer architectures",
limit=5,
# highlight-start
boost=Boost.property(
boost=Boost.numeric_property(
"likes",
modifier=Boost.Modifier.LOG1P,
weight=0.7,
Expand Down Expand Up @@ -167,8 +167,10 @@
limit=5,
# highlight-start
boost=Boost.blend(
Boost.time_decay("published", origin="now", scale=timedelta(days=30), weight=2.0),
Boost.property("likes", modifier=Boost.Modifier.LOG1P, weight=1.0),
[
Boost.time_decay("published", origin="now", scale=timedelta(days=30), weight=2.0),
Boost.numeric_property("likes", modifier=Boost.Modifier.LOG1P, weight=1.0),
],
weight=0.4,
depth=200, # rescore the top 200 vector matches
),
Expand Down Expand Up @@ -222,8 +224,10 @@
limit=5,
# highlight-start
boost=Boost.blend(
Boost.filter(Filter.by_property("category").equal("research"), weight=1.0),
Boost.filter(Filter.by_property("draft").equal(True), weight=-2.0),
[
Boost.filter(Filter.by_property("category").equal("research"), weight=1.0),
Boost.filter(Filter.by_property("draft").equal(True), weight=-2.0),
],
weight=0.3,
),
# highlight-end
Expand Down
2 changes: 1 addition & 1 deletion docs/weaviate/search/boost.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import BoostPreview from '/_includes/feature-notes/boost.mdx';

**Boost** soft-ranks search results — promote or demote matching documents without removing them from the result set. Matching documents move up. Non-matching documents stay in the results but rank lower.

Apply boost to vector, hybrid, BM25, near-text, near-vector, near-object, and aggregate queries.
Apply boost to vector, hybrid, BM25, near-text, near-vector, near-object, near-image, and near-media queries.

## How it works

Expand Down
Loading