Skip to content

Commit 050482c

Browse files
committed
score_functions documentation finished
1 parent d5397b1 commit 050482c

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ Follow the standard plugin installation instructions, with a zip version of the
2424
"rescore": {
2525
"redis":{
2626
"key_field": "productId.keyword",
27-
"key_prefixes": ["mystore-","gympass-"],
27+
"key_prefixes": ["mystore-","gympass-","gym-"],
2828
"score_weights": [0.5, 1.0],
29+
"score_functions":["null","pow(_,2)"],
2930
"score_operator": "ADD",
3031
"boost_operator": "ADD",
3132
"boost_weight": 1.0
@@ -82,6 +83,20 @@ The formula will be:
8283
```
8384
score = elasticsearch_score * ( redis[mystore-20] + redis[gympass-20])
8485
```
86+
<br/>
87+
88+
## --> `score_functions` : str[]
89+
90+
A list that holds the functions to be applied to eatch value on redis, corresponding to the `key_prefixes`.
91+
92+
In the example we have **"null"** linked to `"mystore-"` and **"pow(_, 2)"** linked to `"gympass-"`, what does this mean?
93+
94+
Well **"null"** is the default value, so the `"mystore-"` field will return its normal value without any modification. On the other hand we have the `"gympass-"` field that is beeing afected by the **pow(_,2)** function, in this case the plugin will take the value stored in the redis data base with key `gympass-{productId.keyword}` and a apply it to the function given, where the arg `"_"` is.
95+
96+
In this case lets imagine that the stored value is *3*, so the rescore for that field will be `pow(3,2)` = **9**.
97+
98+
It's important to note that the `score_functions` field, just like the `score_weights`, uses indexes to work.
99+
85100

86101
<br/>
87102
<br/>
@@ -96,6 +111,11 @@ The only field that is **required** for the plugin to run is the `key_field`, al
96111
### `scores_weight` | `boost_weight`
97112
***1***
98113
<br/>
114+
115+
### `score_functions`
116+
***"null"***
117+
<br/>
118+
<br/>
99119
<br/>
100120

101121
# Plugin Installer

0 commit comments

Comments
 (0)