Skip to content

Commit 1ab8d82

Browse files
committed
Merge branch 'increase_sparse_pruning_test_coverage' of github.com:mromaios/elasticsearch into increase_sparse_pruning_test_coverage
2 parents 63b00ff + 248754f commit 1ab8d82

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

server/src/test/java/org/elasticsearch/index/mapper/vectors/SparseVectorFieldMapperTests.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,17 @@ public class SparseVectorFieldMapperTests extends SyntheticVectorsMapperTestCase
7777
public static final float STRICT_TOKENS_FREQ_RATIO_THRESHOLD = 1;
7878

7979
private static final Map<String, Float> COMMON_TOKENS = Map.of(
80-
"common1_drop_default", 0.1f,
81-
"common2_drop_default", 0.1f,
82-
"common3_drop_default", 0.1f
80+
"common1_drop_default",
81+
0.1f,
82+
"common2_drop_default",
83+
0.1f,
84+
"common3_drop_default",
85+
0.1f
8386
);
8487

85-
private static final Map<String, Float> MEDIUM_TOKENS = Map.of(
86-
"medium1_keep_strict", 0.5f,
87-
"medium2_keep_default", 0.25f
88-
);
88+
private static final Map<String, Float> MEDIUM_TOKENS = Map.of("medium1_keep_strict", 0.5f, "medium2_keep_default", 0.25f);
8989

90-
private static final Map<String, Float> RARE_TOKENS = Map.of(
91-
"rare1_keep_strict", 0.9f,
92-
"rare2_keep_strict", 0.85f
93-
);
90+
private static final Map<String, Float> RARE_TOKENS = Map.of("rare1_keep_strict", 0.9f, "rare2_keep_strict", 0.85f);
9491

9592
@Override
9693
protected Object getSampleValueForDocument() {
@@ -849,13 +846,17 @@ private Tuple<Boolean, TokenPruningConfig> getQueryPruneConfig(PruningOptions qu
849846
return new Tuple<>(prune, tokenPruningConfig);
850847
}
851848

852-
private List<Query> getExpectedQueryClauses(SparseVectorFieldMapper.SparseVectorFieldType ft, PruningScenario pruningScenario, SearchExecutionContext searchExecutionContext) {
849+
private List<Query> getExpectedQueryClauses(
850+
SparseVectorFieldMapper.SparseVectorFieldType ft,
851+
PruningScenario pruningScenario,
852+
SearchExecutionContext searchExecutionContext
853+
) {
853854
List<WeightedToken> tokens = switch (pruningScenario) {
854855
case NO_PRUNING -> QUERY_VECTORS;
855856
case DEFAULT_PRUNING -> QUERY_VECTORS.stream()
856-
.filter(t -> t.token().startsWith("rare") || t.token().startsWith("medium")).toList();
857-
case STRICT_PRUNING -> QUERY_VECTORS.stream()
858-
.filter(t -> t.token().endsWith("keep_strict")).toList();
857+
.filter(t -> t.token().startsWith("rare") || t.token().startsWith("medium"))
858+
.toList();
859+
case STRICT_PRUNING -> QUERY_VECTORS.stream().filter(t -> t.token().endsWith("keep_strict")).toList();
859860
};
860861

861862
return tokens.stream().map(t -> {

0 commit comments

Comments
 (0)