Skip to content

Commit b95f333

Browse files
committed
enhance highlight IT
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
1 parent 583b870 commit b95f333

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLHighlightIT.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)