Skip to content

Commit 27e5a9f

Browse files
authored
Document scale config property
1 parent d60a1c9 commit 27e5a9f

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

docs/source/querqy/rewriters/number-unit.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ The default for both properties is ``20``.
108108
"numberUnitDefinitions": [
109109
{
110110
"units": [ { "term": "inch" } ],
111-
"fields": [ { "fieldName": "screen_size" } ],
111+
"fields": [ { "fieldName": "screen_size", "scale": 1 } ],
112112
"filter": {
113113
"percentageLowerBoundary": 20,
114114
"percentageUpperBoundary": 10
@@ -122,6 +122,11 @@ filter query with a lower bound of ``15 - 3 = 12`` and an upper bound of
122122
``15 + 1.5 = 16.5``. Consequently, all notebooks with a screen size between ``12 - 16.5 inch``
123123
are included in the results (boundaries are inclusive).
124124

125+
The field definition takes a ``scale`` property in addition to the ``fieldName``. It defines
126+
to how many digits after the decimal point values should be rounded. In the example above,
127+
we are rounding to ``1`` digit after the decimal point, which makes sure that the ``16.5``
128+
above is not rounded to the full integer. The default scale is ``0``.
129+
125130

126131
Configuring boost queries
127132
=========================
@@ -139,7 +144,7 @@ to appear at the top. The boost properties are all defined in the JSON object ``
139144
"numberUnitDefinitions": [
140145
{
141146
"units": [ { "term": "inch" } ],
142-
"fields": [ { "fieldName": "screen_size" } ],
147+
"fields": [ { "fieldName": "screen_size", "scale": 1 } ],
143148
"boost": {
144149
"percentageLowerBoundary": 10,
145150
"percentageUpperBoundary": 10,
@@ -203,7 +208,7 @@ range. Products that are within this range will also benefit from the boost that
203208
"numberUnitDefinitions": [
204209
{
205210
"units": [ { "term": "inch" } ],
206-
"fields": [ { "fieldName": "screen_size" } ],
211+
"fields": [ { "fieldName": "screen_size", "scale": 1 } ],
207212
"boost": {
208213
"percentageLowerBoundary": 10,
209214
"percentageUpperBoundary": 10,
@@ -245,7 +250,7 @@ be suitable for the respective field. The adjusted value will be used for all fi
245250
{ "term": "inch", "multiplier": 1.0 },
246251
{ "term": "cm", "multiplier": 0.393701 }
247252
],
248-
"fields": [ { "fieldName": "screen_size" } ]
253+
"fields": [ { "fieldName": "screen_size", "scale": 1 } ]
249254
}
250255
]
251256
}
@@ -274,7 +279,7 @@ wrapped by a max() function, which means that the highest boost is applied for t
274279
{ "term": "inch", "multiplier": 1.0 },
275280
{ "term": "cm", "multiplier": 0.393701 }
276281
],
277-
"fields": [ { "fieldName": "screen_size" } ]
282+
"fields": [ { "fieldName": "screen_size", "scale": 1 } ]
278283
},
279284
{
280285
"units": [

0 commit comments

Comments
 (0)