You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<td><p>Unique identifier for this Function</p></td>
421
-
<td><p><code>"rrf"</code></p></td>
469
+
<td><p><code>"boost"</code></p></td>
422
470
</tr>
423
471
<tr>
424
472
<td><p><code>input_field_names</code></p></td>
425
473
<td><p>Yes</p></td>
426
-
<td><p>List of vector fields to apply the function to (must be empty for RRF Ranker)</p></td>
474
+
<td><p>List of vector fields to apply the function to (must be empty for Boost Ranker)</p></td>
427
475
<td><p><code>[]</code></p></td>
428
476
</tr>
429
477
<tr>
@@ -462,6 +510,14 @@ ranker = Function(
462
510
463
511
Once the Boost Ranker function is ready, you can reference it in a search request. The following example assumes that you have already created a collection that has the following fields: **id**, **vector**, and **doctype**.
464
512
513
+
<divclass="multipleCode">
514
+
<a href="#python">Python</a>
515
+
<a href="#java">Java</a>
516
+
<a href="#go">Go</a>
517
+
<a href="#javascript">NodeJS</a>
518
+
<a href="#bash">cURL</a>
519
+
</div>
520
+
465
521
```python
466
522
from pymilvus import MilvusClient
467
523
@@ -475,20 +531,84 @@ client = MilvusClient(
475
531
476
532
# Conduct a similarity search using the created ranker
You can combine multiple Boost Rankers in a single search to influence the search results. To do so, create several Boost Rankers, reference them in a **FunctionScore** instance, and use the **FunctionScore** instance as the ranker in the search request.
489
601
490
602
The following example shows how to modify the scores of all identified entities by applying a weight between **0.8** and **1.2**.
491
603
604
+
<divclass="multipleCode">
605
+
<a href="#python">Python</a>
606
+
<a href="#java">Java</a>
607
+
<a href="#go">Go</a>
608
+
<a href="#javascript">NodeJS</a>
609
+
<a href="#bash">cURL</a>
610
+
</div>
611
+
492
612
```python
493
613
from pymilvus import MilvusClient, Function, FunctionType, FunctionScore
494
614
@@ -523,22 +643,114 @@ ranker = FunctionScore(
523
643
fix_weight_ranker,
524
644
random_weight_ranker
525
645
],
526
-
params: {
527
-
"boost_mode": "Multiply"
646
+
params={
647
+
"boost_mode": "Multiply",
528
648
"function_mode": "Sum"
529
649
}
530
650
)
531
651
532
652
# Conduct a similarity search using the created Function Score
Specifically, there are two Boost Rankers: one applies a fixed weight to all found entities, while the other assigns a random weight to them. Then, we reference these two rankers in a **FunctionScore**, which also defines how the weights influence the scores of the found entities.
543
755
544
756
The following table lists the parameters required to create a **FunctionScore** instance.
@@ -559,13 +771,13 @@ The following table lists the parameters required to create a **FunctionScore**
559
771
<tr>
560
772
<td><p><code>params.boost_mode</code></p></td>
561
773
<td><p>No</p></td>
562
-
<td><p>Specifies how the specified weights influence the scores of any matching entities.</p><p>Possible values are:</p><ul><li><p><code>Multiple</code></p><p>Indicates that the weighted value is equal to the original score of a matching entity multiplied by the specified weight. </p><p>This is the default value.</p></li><li><p><code>Sum</code></p><p>Indicates that the weighted value is equal to the sum of the original score of a matching entity and the specified weight</p></li></ul></td>
774
+
<td><p>Specifies how the specified weights influence the scores of any matching entities.</p><p>Possible values are:</p><ul><li><p><code>Multiply</code></p><p>Indicates that the weighted value is equal to the original score of a matching entity multiplied by the specified weight. </p><p>This is the default value.</p></li><li><p><code>Sum</code></p><p>Indicates that the weighted value is equal to the sum of the original score of a matching entity and the specified weight</p></li></ul></td>
563
775
<td><p><code>"Sum"</code></p></td>
564
776
</tr>
565
777
<tr>
566
778
<td><p><code>params.function_mode</code></p></td>
567
779
<td><p>No</p></td>
568
-
<td><p>Specifies how the weighted values from various Boost Rankers are processed.</p><p>Possible values are:</p><ul><li><p><code>Multiplify</code></p><p>Indicates that the final score of a matching entity is equal to the product of the weighted values from all Boost Rankers.</p><p>This is the default value.</p></li><li><p><code>Sum</code></p><p>Indicates that the final score of a matching entity is equal to the sum of the weighted values from all Boost Rankers.</p></li></ul></td>
780
+
<td><p>Specifies how the weighted values from various Boost Rankers are processed.</p><p>Possible values are:</p><ul><li><p><code>Multiply</code></p><p>Indicates that the final score of a matching entity is equal to the product of the weighted values from all Boost Rankers.</p><p>This is the default value.</p></li><li><p><code>Sum</code></p><p>Indicates that the final score of a matching entity is equal to the sum of the weighted values from all Boost Rankers.</p></li></ul></td>
0 commit comments