-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Optional Arguments for Highlight #112
Conversation
Codecov Report
@@ Coverage Diff @@
## integ-highlight-in-ppl #112 +/- ##
============================================================
+ Coverage 94.88% 94.89% +0.01%
- Complexity 2925 2931 +6
============================================================
Files 288 288
Lines 7875 7900 +25
Branches 575 580 +5
============================================================
+ Hits 7472 7497 +25
Misses 349 349
Partials 54 54
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
a457574
to
cad53f1
Compare
core/src/main/java/org/opensearch/sql/analysis/HighlightAnalyzer.java
Outdated
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/request/OpenSearchRequestBuilder.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/analysis/ExpressionAnalyzer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/ast/expression/HighlightFunction.java
Show resolved
Hide resolved
ccc29e3
to
4fa96cf
Compare
core/src/test/java/org/opensearch/sql/planner/physical/HighlightOperatorTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/opensearch/sql/expression/ExpressionNodeVisitorTest.java
Outdated
Show resolved
Hide resolved
4c6c56a
to
15f6e94
Compare
ca08438
to
43b841d
Compare
15f6e94
to
1abbbee
Compare
core/src/main/java/org/opensearch/sql/analysis/HighlightAnalyzer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/analysis/HighlightAnalyzer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/planner/physical/HighlightOperator.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think are the results of a query like this would be SELECT highlight(Tags, pre_tags='<b>', ...), highlight(Title), highlight(Tags, pre_tags='<i>', ..) FROM ...
?
At first, I though Title will be tagged with <i>
but now I wonder if Tags
will be tagged twice. I came up with it while looking at OpenSearchRequestBuilder
.
integ-test/src/test/java/org/opensearch/sql/sql/HighlightFunctionIT.java
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/request/OpenSearchRequestBuilder.java
Outdated
Show resolved
Hide resolved
@forestmvey also, highlight has a tonne of options (all parse fields can be passed in JSON request AFAIK). I'm happy to leave them out, but let's note that somewhere. |
1abbbee
to
ce55ac3
Compare
Not a valid use-case for OS as it doesn't support repeating highlight fields. Though when I tested this the SQL plugin outputs incorrect data. I have added a SemanticCheckException to handle the case of repeating fields. |
You would like a follow up documentation PR? |
929e539
to
d1abeb2
Compare
|
||
assertEquals(1, response.getInt("total")); | ||
|
||
assertEquals("What are the differences between an <em>IPA</em> and its variants?", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use verifyDataRows
in these tests?
I think there's enough repeated code here to create a matcher that simplifies these tests.
For SQL, the following already works:
verifyDataRows(response,
rows(new JSONArray(List.of("alcohol-level <mark>yeast</mark> home-brew champagne")));
opensearch/src/main/java/org/opensearch/sql/opensearch/request/OpenSearchRequestBuilder.java
Show resolved
Hide resolved
integ-test/src/test/java/org/opensearch/sql/ppl/HighlightFunctionIT.java
Outdated
Show resolved
Hide resolved
|
The upstream PR needs to be clear that it adds |
OS highlighting does not support duplicate fields with different tags. Using the wildcard in this way does seem to be a way to work around not returning an error message from OS. The query
returns
While the query
returns data for only one field
Not sure if this would be a bug because having two fields in OS with different |
Signed-off-by: forestmvey <[email protected]>
d1abeb2
to
df15f37
Compare
Signed-off-by: forestmvey [email protected]
Description
Add support for optional arguments
pre_tags
andpost_tags
for highlight.Issues Resolved
issue: 636
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.