File tree Expand file tree Collapse file tree
integ-test/src/test/java/org/opensearch/sql/calcite/remote Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,13 +68,21 @@ public void testHighlightWithSpecificField() throws IOException {
6868 assertTrue (result .has ("highlights" ));
6969 JSONArray highlights = result .getJSONArray ("highlights" );
7070
71+ boolean foundAddressHighlight = false ;
7172 for (int i = 0 ; i < highlights .length (); i ++) {
7273 if (!highlights .isNull (i )) {
7374 JSONObject hl = highlights .getJSONObject (i );
7475 // Only address field should be highlighted, not other text fields
7576 assertFalse ("Should not highlight firstname field" , hl .has ("firstname" ));
77+ if (hl .has ("address" )) {
78+ String fragment = hl .getJSONArray ("address" ).getString (0 );
79+ assertTrue ("address highlight should contain <em> tags" , fragment .contains ("<em>" ));
80+ assertTrue ("address highlight should contain Street" , fragment .contains ("Street" ));
81+ foundAddressHighlight = true ;
82+ }
7683 }
7784 }
85+ assertTrue ("Expected at least one row with address highlighted" , foundAddressHighlight );
7886 }
7987
8088 @ Test
You can’t perform that action at this time.
0 commit comments