Skip to content

Commit 38bf444

Browse files
authored
Revert "Add l2_norm normalization support to linear retriever (#128504)"
This reverts commit 81fba27.
1 parent 81fba27 commit 38bf444

File tree

6 files changed

+1
-214
lines changed

6 files changed

+1
-214
lines changed

docs/changelog/128504.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/reference/elasticsearch/rest-apis/retrievers.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ Each entry specifies the following parameters:
276276
`normalizer`
277277
: (Optional, String)
278278

279-
- Specifies how we will normalize the retriever’s scores, before applying the specified `weight`. Available values are: `minmax`, `l2_norm`, and `none`. Defaults to `none`.
279+
Specifies how we will normalize the retriever’s scores, before applying the specified `weight`. Available values are: `minmax`, and `none`. Defaults to `none`.
280280

281281
* `none`
282282
* `minmax` : A `MinMaxScoreNormalizer` that normalizes scores based on the following formula
@@ -285,7 +285,6 @@ Each entry specifies the following parameters:
285285
score = (score - min) / (max - min)
286286
```
287287

288-
* `l2_norm` : An `L2ScoreNormalizer` that normalizes scores using the L2 norm of the score values.
289288

290289
See also [this hybrid search example](docs-content://solutions/search/retrievers-examples.md#retrievers-examples-linear-retriever) using a linear retriever on how to independently configure and apply normalizers to retrievers.
291290

x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/linear/L2ScoreNormalizer.java

Lines changed: 0 additions & 63 deletions
This file was deleted.

x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/linear/ScoreNormalizer.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ public abstract class ScoreNormalizer {
1717
public static ScoreNormalizer valueOf(String normalizer) {
1818
if (MinMaxScoreNormalizer.NAME.equalsIgnoreCase(normalizer)) {
1919
return MinMaxScoreNormalizer.INSTANCE;
20-
} else if (L2ScoreNormalizer.NAME.equalsIgnoreCase(normalizer)) {
21-
return L2ScoreNormalizer.INSTANCE;
22-
2320
} else if (IdentityScoreNormalizer.NAME.equalsIgnoreCase(normalizer)) {
2421
return IdentityScoreNormalizer.INSTANCE;
2522

x-pack/plugin/rank-rrf/src/test/java/org/elasticsearch/xpack/rank/linear/L2ScoreNormalizerTests.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

x-pack/plugin/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/linear/10_linear_retriever.yml

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -265,93 +265,6 @@ setup:
265265
- match: { hits.hits.3._id: "3" }
266266
- close_to: { hits.hits.3._score: { value: 0.0, error: 0.001 } }
267267

268-
---
269-
"should normalize initial scores with l2_norm":
270-
- do:
271-
search:
272-
index: test
273-
body:
274-
retriever:
275-
linear:
276-
retrievers: [
277-
{
278-
retriever: {
279-
standard: {
280-
query: {
281-
bool: {
282-
should: [
283-
{ constant_score: { filter: { term: { keyword: { value: "one" } } }, boost: 3.0 } },
284-
{ constant_score: { filter: { term: { keyword: { value: "two" } } }, boost: 4.0 } }
285-
]
286-
}
287-
}
288-
}
289-
},
290-
weight: 10.0,
291-
normalizer: "l2_norm"
292-
},
293-
{
294-
retriever: {
295-
standard: {
296-
query: {
297-
bool: {
298-
should: [
299-
{ constant_score: { filter: { term: { keyword: { value: "three" } } }, boost: 6.0 } },
300-
{ constant_score: { filter: { term: { keyword: { value: "four" } } }, boost: 8.0 } }
301-
]
302-
}
303-
}
304-
}
305-
},
306-
weight: 2.0,
307-
normalizer: "l2_norm"
308-
}
309-
]
310-
311-
- match: { hits.total.value: 4 }
312-
- match: { hits.hits.0._id: "2" }
313-
- match: { hits.hits.0._score: 8.0 }
314-
- match: { hits.hits.1._id: "1" }
315-
- match: { hits.hits.1._score: 6.0 }
316-
- match: { hits.hits.2._id: "4" }
317-
- close_to: { hits.hits.2._score: { value: 1.6, error: 0.001 } }
318-
- match: { hits.hits.3._id: "3" }
319-
- match: { hits.hits.3._score: 1.2 }
320-
321-
---
322-
"should handle all zero scores in normalization":
323-
- do:
324-
search:
325-
index: test
326-
body:
327-
retriever:
328-
linear:
329-
retrievers: [
330-
{
331-
retriever: {
332-
standard: {
333-
query: {
334-
bool: {
335-
should: [
336-
{ constant_score: { filter: { term: { keyword: { value: "one" } } }, boost: 0.0 } },
337-
{ constant_score: { filter: { term: { keyword: { value: "two" } } }, boost: 0.0 } },
338-
{ constant_score: { filter: { term: { keyword: { value: "three" } } }, boost: 0.0 } },
339-
{ constant_score: { filter: { term: { keyword: { value: "four" } } }, boost: 0.0 } }
340-
]
341-
}
342-
}
343-
}
344-
},
345-
weight: 1.0,
346-
normalizer: "l2_norm"
347-
}
348-
]
349-
- match: { hits.total.value: 4 }
350-
- close_to: { hits.hits.0._score: { value: 0.0, error: 0.0001 } }
351-
- close_to: { hits.hits.1._score: { value: 0.0, error: 0.0001 } }
352-
- close_to: { hits.hits.2._score: { value: 0.0, error: 0.0001 } }
353-
- close_to: { hits.hits.3._score: { value: 0.0, error: 0.0001 } }
354-
355268
---
356269
"should throw on unknown normalizer":
357270
- do:

0 commit comments

Comments
 (0)