Skip to content

Commit 2745595

Browse files
committed
added comments
1 parent f1c3b4d commit 2745595

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/framework/src/main/java/org/elasticsearch/index/mapper/AbstractScriptFieldTypeTestCase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,8 @@ public final void testIsParsedFromSource() throws IOException {
443443
MapperService mapperService = createMapperService(mapping);
444444
SearchExecutionContext c = createSearchExecutionContext(mapperService);
445445
{
446+
// The field_source uses parseFromSource(...) in compileScript(...) method in this class.
447+
// This triggers calling SearchLookup#optimizedSourceProvider(...) which should return more optimized source.
446448
var fieldType = (AbstractScriptFieldType) c.getFieldType("field_source");
447449
SearchLookup searchLookup = mock(SearchLookup.class);
448450
when(searchLookup.optimizedSourceProvider(any())).thenReturn(searchLookup);
@@ -451,6 +453,7 @@ public final void testIsParsedFromSource() throws IOException {
451453
verify(searchLookup, times(1)).optimizedSourceProvider(any());
452454
}
453455
{
456+
// The field uses normal scripts and that should never cause SearchLookup#optimizedSourceProvider(...) to be invoked:
454457
var fieldType = (AbstractScriptFieldType) c.getFieldType("field");
455458
SearchLookup searchLookup = mock(SearchLookup.class);
456459
when(searchLookup.optimizedSourceProvider(any())).thenReturn(searchLookup);

0 commit comments

Comments
 (0)