|
40 | 40 | import org.elasticsearch.search.lookup.Source; |
41 | 41 | import org.elasticsearch.search.vectors.SparseVectorQueryWrapper; |
42 | 42 | import org.elasticsearch.test.index.IndexVersionUtils; |
43 | | -import org.elasticsearch.test.junit.annotations.TestLogging; |
44 | 43 | import org.elasticsearch.xcontent.ToXContent; |
45 | 44 | import org.elasticsearch.xcontent.XContentBuilder; |
46 | 45 | import org.elasticsearch.xcontent.XContentParseException; |
|
50 | 49 | import org.junit.AssumptionViolatedException; |
51 | 50 |
|
52 | 51 | import java.io.IOException; |
53 | | -import java.util.ArrayList; |
54 | 52 | import java.util.Arrays; |
55 | 53 | import java.util.Collection; |
56 | 54 | import java.util.EnumSet; |
@@ -79,20 +77,17 @@ public class SparseVectorFieldMapperTests extends SyntheticVectorsMapperTestCase |
79 | 77 | public static final float STRICT_TOKENS_FREQ_RATIO_THRESHOLD = 1; |
80 | 78 |
|
81 | 79 | private static final Map<String, Float> COMMON_TOKENS = Map.of( |
82 | | - "common1_drop_default", 0.1f, |
83 | | - "common2_drop_default", 0.1f, |
84 | | - "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 |
85 | 86 | ); |
86 | 87 |
|
87 | | - private static final Map<String, Float> MEDIUM_TOKENS = Map.of( |
88 | | - "medium1_keep_strict", 0.5f, |
89 | | - "medium2_keep_default", 0.25f |
90 | | - ); |
| 88 | + private static final Map<String, Float> MEDIUM_TOKENS = Map.of("medium1_keep_strict", 0.5f, "medium2_keep_default", 0.25f); |
91 | 89 |
|
92 | | - private static final Map<String, Float> RARE_TOKENS = Map.of( |
93 | | - "rare1_keep_strict", 0.9f, |
94 | | - "rare2_keep_strict", 0.85f |
95 | | - ); |
| 90 | + private static final Map<String, Float> RARE_TOKENS = Map.of("rare1_keep_strict", 0.9f, "rare2_keep_strict", 0.85f); |
96 | 91 |
|
97 | 92 | @Override |
98 | 93 | protected Object getSampleValueForDocument() { |
@@ -877,13 +872,17 @@ private Tuple<Boolean, TokenPruningConfig> getQueryPruneConfig(QueryPruningScena |
877 | 872 | }; |
878 | 873 | } |
879 | 874 |
|
880 | | - private List<Query> getExpectedQueryClauses(SparseVectorFieldMapper.SparseVectorFieldType ft, PruningScenario pruningScenario, SearchExecutionContext searchExecutionContext) { |
| 875 | + private List<Query> getExpectedQueryClauses( |
| 876 | + SparseVectorFieldMapper.SparseVectorFieldType ft, |
| 877 | + PruningScenario pruningScenario, |
| 878 | + SearchExecutionContext searchExecutionContext |
| 879 | + ) { |
881 | 880 | List<WeightedToken> tokens = switch (pruningScenario) { |
882 | 881 | case NO_PRUNING -> QUERY_VECTORS; |
883 | 882 | case DEFAULT_PRUNING -> QUERY_VECTORS.stream() |
884 | | - .filter(t -> t.token().startsWith("rare") || t.token().startsWith("medium")).toList(); |
885 | | - case STRICT_PRUNING -> QUERY_VECTORS.stream() |
886 | | - .filter(t -> t.token().endsWith("keep_strict")).toList(); |
| 883 | + .filter(t -> t.token().startsWith("rare") || t.token().startsWith("medium")) |
| 884 | + .toList(); |
| 885 | + case STRICT_PRUNING -> QUERY_VECTORS.stream().filter(t -> t.token().endsWith("keep_strict")).toList(); |
887 | 886 | }; |
888 | 887 |
|
889 | 888 | return tokens.stream().map(t -> { |
|
0 commit comments