Skip to content

Commit ac52d06

Browse files
committed
Fix typo
1 parent c05fdb3 commit ac52d06

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

server/src/main/java/org/elasticsearch/index/fieldvisitor/StoredFieldLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static StoredFieldLoader fromSpec(StoredFieldsSpec spec) {
5858
}
5959

6060
/**
61-
* Crates a new StoredFieldLaoader using a BlockLoader.FieldsSpec
61+
* Crates a new StoredFieldLoader using a BlockLoader.FieldsSpec
6262
*/
6363
public static StoredFieldLoader fromSpec(BlockLoader.FieldsSpec spec, boolean forceSequentialReader) {
6464
if (spec.noRequirements()) {

server/src/test/java/org/elasticsearch/index/fieldvisitor/IgnoredSourceFieldLoaderTests.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
import static org.hamcrest.Matchers.hasKey;
3636
import static org.hamcrest.Matchers.not;
3737

38+
/**
39+
* Test that the {@link IgnoredSourceFieldLoader} loads the correct stored values.
40+
*/
3841
public class IgnoredSourceFieldLoaderTests extends ESTestCase {
3942
public void testSupports() {
4043
assertTrue(
@@ -70,6 +73,8 @@ public void testSupports() {
7073
}
7174

7275
public void testLoadSingle() throws IOException {
76+
// Note: normally the stored value is encoded in the ignored source format
77+
// (see IgnoredSourceFieldMapper#encodeMultipleValuesForField), but these tests are only verifying the loader, not the encoding.
7378
BytesRef value = new BytesRef("lorem ipsum");
7479
Document doc = new Document();
7580
doc.add(new StoredField("_ignored_source.foo", value));
@@ -89,8 +94,8 @@ public void testLoadMultiple() throws IOException {
8994
doc.add(new StoredField("_ignored_source.foo", fooValue));
9095
doc.add(new StoredField("_ignored_source.bar", barValue));
9196
testLoader(doc, Set.of("foo", "bar"), storedFields -> {
92-
assertThat(storedFields, hasEntry(equalTo("foo"), containsInAnyOrder(fooValue)));
93-
assertThat(storedFields, hasEntry(equalTo("bar"), containsInAnyOrder(barValue)));
97+
assertThat(storedFields, hasEntry(equalTo("_ignored_source.foo"), containsInAnyOrder(fooValue)));
98+
assertThat(storedFields, hasEntry(equalTo("_ignored_source.bar"), containsInAnyOrder(barValue)));
9499
});
95100
}
96101

@@ -103,8 +108,8 @@ public void testLoadSubset() throws IOException {
103108
doc.add(new StoredField("_ignored_source.bar", barValue));
104109

105110
testLoader(doc, Set.of("foo"), storedFields -> {
106-
assertThat(storedFields, hasEntry(equalTo("foo"), containsInAnyOrder(fooValue)));
107-
assertThat(storedFields, not(hasKey("bar")));
111+
assertThat(storedFields, hasEntry(equalTo("_ignored_source.foo"), containsInAnyOrder(fooValue)));
112+
assertThat(storedFields, not(hasKey("_ignored_source.bar")));
108113
});
109114
}
110115

@@ -121,6 +126,7 @@ private void testLoader(Document doc, Set<String> fieldsToLoad, Consumer<Map<Str
121126
IgnoredSourceFieldLoader loader = new IgnoredSourceFieldLoader(spec, false);
122127
var leafLoader = loader.getLoader(reader.leaves().getFirst(), new int[] { 0 });
123128
leafLoader.advanceTo(0);
129+
storedFieldsConsumer.accept(leafLoader.storedFields());
124130
}
125131
}
126132
}

0 commit comments

Comments
 (0)